Add files via upload

This commit is contained in:
Ahmed Kawa 2023-08-18 06:53:04 +03:00 committed by GitHub
parent c8e13d6f04
commit 0e82207551
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
89 changed files with 13812 additions and 0 deletions

290
admin_bans.php Normal file
View File

@ -0,0 +1,290 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 1)
message($lang_common['No permission']);
// Add a ban (stage 1)
if (isset($_REQUEST['add_ban']))
{
// If the id of the user to ban was provided through GET (a link from profile.php)
if (isset($_GET['add_ban']))
{
$add_ban = intval($_GET['add_ban']);
if (empty($add_ban))
message($lang_common['Bad request']);
$ban_id = $add_ban;
$result = $db->query('SELECT username, email FROM '.$db->prefix.'users WHERE id='.$ban_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
list($ban_user, $ban_email) = $db->fetch_row($result);
$result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE poster_id='.$ban_id.' ORDER BY posted DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
$ban_ip = $db->result($result, 0);
}
else
message('No user by that ID registered.');
}
else // Otherwise the username is in POST
{
$ban_user = trim($_POST['new_ban_user']);
if ($ban_user != '')
{
$result = $db->query('SELECT id, username, email FROM '.$db->prefix.'users WHERE username=\''.escape(strtolower($ban_user)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
list($ban_id, $ban_user, $ban_email) = $db->fetch_row($result);
$result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE poster_id='.$ban_id.' ORDER BY posted DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
$ban_ip = $db->result($result, 0);
}
else
message('No user by that username registered. If you want to add a ban not tied to a specific username just leave the username blank.');
}
}
$page_title = htmlspecialchars($options['board_title']).' / Admin / Bans';
$form_name = 'bans2';
$focus_element = 'new_ban_ip';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('bans');
else
moderator_menu('bans');
?>
<form method="post" action="admin_bans.php" id="bans2">
<input type="hidden" name="new_ban_user" value="<?php print htmlspecialchars($ban_user) ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Supplement ban with IP and e-mail</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">IP and e-mail&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Username</b></td>
<td style="width: 35%"><?php print ($ban_user != '') ? htmlspecialchars($ban_user) : 'No user' ?></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>IP</b><br>The IP or partiall IP you wish to ban (e.g. 150.11.110.1 or 150.11.110). If an IP is entered already it is the last known IP of this user in the database.<?php if ($ban_user != '') print ' Click <a href="admin_users.php?ip_stats='.$ban_id.'">here</a> to see IP statistics for this user.' ?></td>
<td style="width: 35%"><input type="text" name="new_ban_ip" size="20" maxlength="15" value="<?php print $ban_ip ?>" tabindex="1"></td>
<td class="puncent" style="width: 30%" rowspan="2"><input type="submit" name="add_ban2" value=" Add " tabindex="4"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>E-mail/domain</b><br>The e-mail or e-mail domain you wish to ban (e.g. someone@somewhere.com or somewhere.com). See option "Allow banned e-mail addresses" in Admin/Options for more info.</td>
<td style="width: 35%"><input type="text" name="new_ban_email" size="35" maxlength="50" value="<?php print strtolower($ban_email) ?>" tabindex="2"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Expire date</b><br>The date when this ban should be removed (format: yyyy-mm-dd). Leave blank to remove manually.</td>
<td style="width: 35%"><input type="text" name="new_ban_expire" size="17" maxlength="10" tabindex="3"></td>
</tr>
<tr>
<td colspan="3">You should be very careful when banning partial IP's because of the possibility of multiple users matching the same partial IP.</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
// Add a ban (stage 2)
else if (isset($_POST['add_ban2']))
{
confirm_referer('admin_bans.php');
$ban_user = $_POST['new_ban_user'];
$ban_ip = trim($_POST['new_ban_ip']);
$ban_email = strtolower(trim($_POST['new_ban_email']));
$ban_expire = trim($_POST['new_ban_expire']);
if ($ban_user == '' && $ban_ip == '' && $ban_email == '')
message('You must enter either a username, an IP address or an e-mail address (at least).');
require 'include/email.php';
if ($ban_email != '' && !is_valid_email($ban_email))
{
if (!preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $ban_email))
message('The e-mail address (e.g. user@domain.com) or partial e-mail address domain (e.g. domain.com) you entered is invalid.');
}
if ($ban_expire != '' && $ban_expire != 'Never')
{
$ban_expire = strtotime($ban_expire);
if ($ban_expire == -1 || $ban_expire <= time())
message('You entered an invalid expire date. The format should be yyyy-mm-dd and the date must be at least one day forward from today.');
}
else
$ban_expire = 'NULL';
$ban_user = ($ban_user != '') ? '\''.escape($ban_user).'\'' : 'NULL';
$ban_ip = ($ban_ip != '') ? '\''.escape($ban_ip).'\'' : 'NULL';
$ban_email = ($ban_email != '') ? '\''.escape($ban_email).'\'' : 'NULL';
$db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, expire) VALUES('.$ban_user.', '.$ban_ip.', '.$ban_email.', '.$ban_expire.')') or error('Unable to add ban', __FILE__, __LINE__, $db->error());
redirect('admin_bans.php', 'Ban added. Redirecting ...');
}
// Update a ban
else if (isset($_POST['update']))
{
confirm_referer('admin_bans.php');
$id = key($_POST['update']);
$ban_user = trim($_POST['ban_user'][$id]);
$ban_ip = trim($_POST['ban_ip'][$id]);
$ban_email = trim($_POST['ban_email'][$id]);
$ban_expire = trim($_POST['ban_expire'][$id]);
if ($ban_user == '' && $ban_ip == '' && $ban_email == '')
message('You must enter eighter a username, an IP address or an e-mail address (at least).');
require_once 'include/email.php';
if ($ban_email != '' && !is_valid_email($ban_email))
{
if (!preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $ban_email))
message('The e-mail address (e.g. user@domain.com) or partial e-mail address domain (e.g. domain.com) you entered is invalid.');
}
if ($ban_expire != '' && $ban_expire != 'Never')
{
$ban_expire = strtotime($ban_expire);
if ($ban_expire == -1 || $ban_expire <= time())
message('You entered an invalid expire date. The format should be yyyy-mm-dd and the date must be at least one day forward from today.');
}
else
$ban_expire = 'NULL';
$ban_user = ($ban_user != '') ? '\''.escape($ban_user).'\'' : 'NULL';
$ban_ip = ($ban_ip != '') ? '\''.escape($ban_ip).'\'' : 'NULL';
$ban_email = ($ban_email != '') ? '\''.escape($ban_email).'\'' : 'NULL';
$db->query('UPDATE '.$db->prefix.'bans SET username='.$ban_user.', ip='.$ban_ip.', email='.$ban_email.', expire='.$ban_expire.' WHERE id='.$id) or error('Unable to update ban', __FILE__, __LINE__, $db->error());
redirect('admin_bans.php', 'Ban updated. Redirecting ...');
}
// Remove a ban
else if (isset($_POST['remove']))
{
confirm_referer('admin_bans.php');
$id = key($_POST['remove']);
$db->query('DELETE FROM '.$db->prefix.'bans WHERE id='.$id) or error('Unable to delete ban', __FILE__, __LINE__, $db->error());
redirect('admin_bans.php', 'Ban removed. Redirecting ...');
}
$page_title = htmlspecialchars($options['board_title']).' / Admin / Bans';
$form_name = 'bans';
$focus_element = 'new_ban_user';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('bans');
else
moderator_menu('bans');
?>
<form method="post" action="admin_bans.php?action=more" id="bans">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Bans</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Add ban&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Username</b><br>The username to ban (case insensitive). The next page will let you enter a custom IP and e-mail. If you just want to ban a specific IP/IP-range or e-mail just leave it blank.</td>
<td style="width: 35%"><input type="text" name="new_ban_user" size="25" maxlength="25"></td>
<td style="width: 30%"><input type="submit" name="add_ban" value=" Add "></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Edit/remove bans&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td>
<?php
$result = $db->query('SELECT id, username, ip, email, expire FROM '.$db->prefix.'bans ORDER BY id') or error('Unable to ban list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while ($cur_ban = $db->fetch_assoc($result))
{
$expire = format_time($cur_ban['expire'], true);
print "\t\t\t\t\t\t\t".'&nbsp;&nbsp;&nbsp;Username&nbsp;&nbsp;<input type="text" name="ban_user['.$cur_ban['id'].']" value="'.$cur_ban['username'].'" size="13" maxlength="25">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IP&nbsp;&nbsp;<input type="text" name="ban_ip['.$cur_ban['id'].']" value="'.$cur_ban['ip'].'" size="17" maxlength="15">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E-mail&nbsp;&nbsp;<input type="text" name="ban_email['.$cur_ban['id'].']" value="'.$cur_ban['email'].'" size="22" maxlength="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Expire&nbsp;&nbsp;<input type="text" name="ban_expire['.$cur_ban['id'].']" value="'.$expire.'" size="13" maxlength="10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="update['.$cur_ban['id'].']" value="Update">&nbsp;<input type="submit" name="remove['.$cur_ban['id'].']" value="Remove"><br>'."\n";
}
}
else
print "\t\t\t\t\t\t\t".'No bans in list.'."\n";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

221
admin_categories.php Normal file
View File

@ -0,0 +1,221 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 2)
message($lang_common['No permission']);
if (isset($_POST['add_cat'])) // Add a new category
{
confirm_referer('admin_categories.php');
$new_cat_name = trim($_POST['new_cat_name']);
if ($new_cat_name == '')
message('You must enter a name for the category.');
$db->query('INSERT INTO '.$db->prefix.'categories (cat_name) VALUES(\''.escape($new_cat_name).'\')') or error('Unable to create category', __FILE__, __LINE__, $db->error());
redirect('admin_categories.php', 'Category added. Redirecting ...');
}
else if (isset($_POST['del_cat']) || isset($_POST['comply']))
{
confirm_referer('admin_categories.php');
$cat_to_delete = intval($_POST['cat_to_delete']);
if (empty($cat_to_delete))
message($lang_common['Bad request']);
if (isset($_POST['comply'])) // Delete a category with all forums and posts
{
@set_time_limit(0);
$result = $db->query('SELECT id FROM '.$db->prefix.'forums WHERE cat_id='.$cat_to_delete) or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
$num_forums = $db->num_rows($result);
for ($i = 0; $i < $num_forums; $i++)
{
$cur_forum = $db->result($result, $i);
// Prune all posts and topics (start transaction)
prune($cur_forum, 1, -1);
// Delete the forum (end transaction)
$db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$cur_forum, PUN_TRANS_END) or error('Unable to delete forum', __FILE__, __LINE__, $db->error());
}
// Locate any "orphaned redirect topics" and delete them
$result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT OUTER JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error());
$num_orphans = $db->num_rows($result);
if ($num_orphans)
{
for ($i = 0; $i < $num_orphans; $i++)
$orphans[] = $db->result($result, $i);
$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
}
// Delete the category
$db->query('DELETE FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to delete category', __FILE__, __LINE__, $db->error());
redirect('admin_categories.php', 'Category deleted. Redirecting ...');
}
else // If the user hasn't comfirmed the delete
{
$page_title = htmlspecialchars($options['board_title']).' / Admin / Categories';
require 'header.php';
admin_menu('categories');
?>
<form method="post" action="admin_categories.php">
<input type="hidden" name="cat_to_delete" value="<?php print $cat_to_delete ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">Confirm delete category</td>
</tr>
<tr>
<td class="puncon2">
<br>&nbsp;Are you sure that you want to delete this category?<br><br>
&nbsp;WARNING! Deleting a category will delete all forums and posts (if any) in that category!<br><br>
&nbsp;<input type="submit" name="comply" value=" OK ">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)">Go back</a><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
}
else if (isset($_POST['update'])) // Change order, name and admmod_only of the categories
{
confirm_referer('admin_categories.php');
$cat_order = $_POST['cat_order'];
$cat_name = $_POST['cat_name'];
$admmod_only = $_POST['admmod_only'];
$result = $db->query('SELECT id, position FROM '.$db->prefix.'categories ORDER BY position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
$num_cats = $db->num_rows($result);
for ($i = 0; $i < $num_cats; $i++)
{
if ($cat_name[$i] == '')
message('You must enter a category name.');
if ($cat_order[$i] == '' || preg_match('/[^0-9]/', $cat_order[$i]))
message('Position must be an integer value.');
if ($admmod_only[$i] != '1')
$admmod_only[$i] = '0';
list($cat_id, $position) = $db->fetch_row($result);
$db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.escape($cat_name[$i]).'\', admmod_only=\''.$admmod_only[$i].'\', position='.$cat_order[$i].' WHERE id='.$cat_id) or error('Unable to update category', __FILE__, __LINE__, $db->error());
}
redirect('admin_categories.php', 'Category updated. Redirecting ...');
}
// Generate an array with all categories
$result = $db->query('SELECT id, cat_name, admmod_only, position FROM '.$db->prefix.'categories ORDER BY position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
$num_cats = $db->num_rows($result);
for ($i = 0; $i < $num_cats; $i++)
$cat_list[] = $db->fetch_row($result);
$page_title = htmlspecialchars($options['board_title']).' / Admin / Categories';
require 'header.php';
admin_menu('categories');
?>
<form method="post" action="admin_categories.php?action=foo">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Add/remove/edit categories</td>
</tr>
<?php if ($num_cats): ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Edit categories&nbsp;&nbsp;</td>
<td class="puncon2">
<?php
foreach ($cat_list as $cat_info) {
list($cat_id, $cat_name, $admmod_only, $position) = $cat_info;
// do something with the variables
?>
<br>&nbsp;&nbsp;Position&nbsp;&nbsp;<input type="text" name="cat_order[<?php print $i ?>]" value="<?php print $position ?>" size="3" maxlength="3">&nbsp;&nbsp&nbsp&nbsp;&nbsp;Name&nbsp;&nbsp;<input type="text" name="cat_name[<?php print $i ?>]" value="<?php print htmlspecialchars($cat_name) ?>" size="30" maxlength="30">&nbsp;&nbsp&nbsp&nbsp;&nbsp;<input type="checkbox" name="admmod_only[<?php print $i ?>]" value="1"<?php if ($admmod_only == '1') print ' checked' ?>>&nbsp;Admins/moderators only
<?php
}
?>
<br><br>&nbsp;&nbsp;<input type="submit" name="update" value="Update"><br><br>
</td>
</tr>
<?php endif; ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Add a new category&nbsp;&nbsp;</td>
<td class="puncon2">
<br>&nbsp;<input type="text" name="new_cat_name" size="30" maxlength="30"><br><br>
&nbsp;&nbsp;<input type="submit" name="add_cat" value=" Add "><br><br>
</td>
</tr>
<?php if ($num_cats): ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Delete a category&nbsp;&nbsp;</td>
<td class="puncon2">
<br>&nbsp;<select name="cat_to_delete">
<?php
@reset($cat_list);
foreach ($cat_list as [$cat_id, $cat_name])
print "\t\t\t\t\t".'<option value="'.$cat_id.'">'.htmlspecialchars($cat_name).'</option>'."\n";
?>
</select><br><br>
&nbsp;&nbsp;<input type="submit" name="del_cat" value="Delete"><br><br>
</td>
</tr>
<?php endif; ?> </table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

148
admin_censoring.php Normal file
View File

@ -0,0 +1,148 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 1)
message($lang_common['No permission']);
// Add a censor word
if (isset($_POST['add_word']))
{
confirm_referer('admin_censoring.php');
$search_for = trim($_POST['new_search_for']);
$replace_with = trim($_POST['new_replace_with']);
if ($search_for == '' || $replace_with == '')
message('You must enter both a word to censor and text to replace it with.');
$db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.escape($search_for).'\', \''.escape($replace_with).'\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error());
redirect('admin_censoring.php', 'Censor word added. Redirecting ...');
}
// Update a censor word
else if (isset($_POST['update']))
{
confirm_referer('admin_censoring.php');
$id = key($_POST['update']);
$search_for = trim($_POST['search_for'][$id]);
$replace_with = trim($_POST['replace_with'][$id]);
if ($search_for == '' || $replace_with == '')
message('You must enter both text to search for and text to replace with.');
$db->query('UPDATE '.$db->prefix.'censoring SET search_for=\''.escape($search_for).'\', replace_with=\''.escape($replace_with).'\' WHERE id='.$id) or error('Unable to update censor word', __FILE__, __LINE__, $db->error());
redirect('admin_censoring.php', 'Censor word updated. Redirecting ...');
}
// Remove a censor word
else if (isset($_POST['remove']))
{
confirm_referer('admin_censoring.php');
$id = key($_POST['remove']);
$db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error());
redirect('admin_censoring.php', 'Censor word removed. Redirecting ...');
}
$page_title = htmlspecialchars($options['board_title']).' / Admin / Censoring';
$form_name = 'censoring';
$focus_element = 'new_search_for';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('censoring');
else
moderator_menu('censoring');
?>
<form method="post" action="admin_censoring.php?action=foo" id="censoring">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Censoring</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Add word&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td colspan="3">Enter a word that you want to censor and the replacement text for this word. Wildcards are accepted (i.e. *some* would match somewhere and lonesome). Censor words also affect usernames. New users will not be able to register with usernames containing any censored words. The search is case insensitive. <b>Censor words must be enabled in <a href="admin_options.php#censoring">Options</a> for this to have any effect.</b><br><br></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Word</b><br>The word to censor.</td>
<td style="width: 35%"><input type="text" name="new_search_for" size="35" maxlength="60" tabindex="1"></td>
<td style="width: 30%" rowspan="2"><input type="submit" name="add_word" value=" Add " tabindex="3"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Replacement</b><br>The text to replace the matching censored word with.</td>
<td style="width: 35%"><input type="text" name="new_replace_with" size="35" maxlength="60" tabindex="2"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Edit/remove words&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td>
<?php
$result = $db->query('SELECT id, search_for, replace_with FROM '.$db->prefix.'censoring ORDER BY id') or error('Unable to fetch censor word list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while ($cur_word = $db->fetch_assoc($result))
print "\t\t\t\t\t\t\t".'&nbsp;&nbsp;&nbsp;Word&nbsp;&nbsp;<input type="text" name="search_for['.$cur_word['id'].']" value="'.$cur_word['search_for'].'" size="25" maxlength="60">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replacement&nbsp;&nbsp;<input type="text" name="replace_with['.$cur_word['id'].']" value="'.$cur_word['replace_with'].'" size="25" maxlength="60">&nbsp;&nbsp&nbsp&nbsp;&nbsp;<input type="submit" name="update['.$cur_word['id'].']" value="Update">&nbsp;<input type="submit" name="remove['.$cur_word['id'].']" value="Remove"><br>'."\n";
}
else
print "\t\t\t\t\t\t\t".'No censor words in list.'."\n";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

299
admin_forums.php Normal file
View File

@ -0,0 +1,299 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 2)
message($lang_common['No permission']);
// Add a "default" forum
if (isset($_POST['add_forum']))
{
confirm_referer('admin_forums.php');
$add_to_cat = intval($_POST['add_to_cat']);
if (empty($add_to_cat))
message($lang_common['Bad request']);
$db->query('INSERT INTO '.$db->prefix.'forums (cat_id) VALUES('.$add_to_cat.')') or error('Unable to create forum', __FILE__, __LINE__, $db->error());
redirect('admin_forums.php', 'Forum added. Redirecting ...');
}
// Delete a forum
else if (isset($_POST['del_forum']) || isset($_POST['comply']))
{
confirm_referer('admin_forums.php');
$forum_to_delete = intval($_POST['forum_to_delete']);
if (empty($forum_to_delete))
message($lang_common['Bad request']);
if (isset($_POST['comply'])) // Delete a forum with all posts
{
@set_time_limit(0);
// Prune all posts and topics (start transaction)
prune($forum_to_delete, 1, -1);
// Locate any "orphaned redirect topics" and delete them
$result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT OUTER JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error());
$num_orphans = $db->num_rows($result);
if ($num_orphans)
{
for ($i = 0; $i < $num_orphans; $i++)
$orphans[] = $db->result($result, $i);
$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
}
// Delete the forum (end transaction)
$db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_to_delete, PUN_TRANS_END) or error('Unable to delete forum', __FILE__, __LINE__, $db->error());
redirect('admin_forums.php', 'Forum deleted. Redirecting ...');
}
else // If the user hasn't confirmed the delete
{
$page_title = htmlspecialchars($options['board_title']).' / Admin / Forums';
require 'header.php';
admin_menu('forums');
?>
<form method="post" action="admin_forums.php">
<input type="hidden" name="forum_to_delete" value="<?php print $forum_to_delete ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">Confirm delete forum</td>
</tr>
<tr>
<td class="puncon2">
<br>&nbsp;Are you sure that you want to delete this forum?<br><br>
&nbsp;WARNING! Deleting a forum will delete all posts (if any) in that forum!<br><br>
&nbsp;<input type="submit" name="comply" value=" OK ">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)">Go back</a><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
}
// Update one or more forums
else if (isset($_POST['update']) || isset($_POST['updateall']))
{
confirm_referer('admin_forums.php');
$forums_to_process = (isset($_POST['update'])) ? array_keys($_POST['update']) : array_keys($_POST['forum_name']);
foreach ($forums_to_process as $id)
{
$cur_position = $_POST['position'][$id];
$cur_forum_name = trim($_POST['forum_name'][$id]);
$cur_forum_desc = trim($_POST['forum_desc'][$id]);
$cur_admmod_only = isset($_POST['admmod_only'][$id]);
$cur_closed = isset($_POST['closed'][$id]);
$cur_cat_id = intval($_POST['cat_id'][$id]);
if ($cur_forum_name == '')
message('You must enter a forum name.');
if ($cur_position == '' || preg_match('/[^0-9]/', $cur_position))
message('Position must be a positive integer value.');
if (empty($cur_cat_id))
message($lang_common['Bad request']);
if ($cur_closed != '1') $cur_closed = '0';
if ($cur_admmod_only != '1') $cur_admmod_only = '0';
$cur_forum_desc = ($cur_forum_desc != '') ? '\''.escape(str_replace("\r", "\n", str_replace("\r\n", "\n", $cur_forum_desc))).'\'' : 'NULL';
$db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.escape($cur_forum_name).'\', forum_desc='.$cur_forum_desc.', closed=\''.$cur_closed.'\', admmod_only=\''.$cur_admmod_only.'\', position='.$cur_position.', cat_id='.$cur_cat_id.' WHERE id='.$id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
}
redirect('admin_forums.php', 'Forum(s) updated. Redirecting ...');
}
// Generate an array with all forums and their respective category (used frequently)
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.closed, f.admmod_only, f.position FROM '.$db->prefix.'categories AS c LEFT JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
$num_forums = $db->num_rows($result);
$forum_list = array();
while ($num_forums--)
$forum_list[] = $db->fetch_assoc($result);
$page_title = htmlspecialchars($options['board_title']).' / Admin / Forums';
require 'header.php';
admin_menu('forums');
?>
<form method="post" action="admin_forums.php?action=adddel">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Add/delete forums</td>
</tr>
<tr class="puncon1">
<td class="puncent" style="width: 50%">
<br>&nbsp;&nbsp;Add forum to category&nbsp;&nbsp;<select name="add_to_cat">
<?php
$cur_category = 0;
foreach ($forum_list as $cur_forum)
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
print "\t\t\t\t\t".'<option value="'.htmlspecialchars($cur_forum['cid']).'">'.htmlspecialchars($cur_forum['cat_name']).'</option>'."\n";
$cur_category = $cur_forum['cid'];
}
}
?>
</select>
&nbsp;&nbsp;<input type="submit" name="add_forum" value=" Add "><br><br>
</td>
<td class="puncent" style="width: 50%">
<br>&nbsp;&nbsp;Delete forum&nbsp;&nbsp;<select name="forum_to_delete">
<?php
$cur_category = 0;
@reset($forum_list);
foreach ($forum_list as $cur_forum)
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
print "\t\t\t\t\t".'<optgroup label="'.htmlspecialchars($cur_forum['cat_name']).'">'."\n";
$cur_category = $cur_forum['cid'];
}
if ($cur_forum['fid'] != '')
print "\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'">'.htmlspecialchars($cur_forum['forum_name']).'</option>'."\n";
}
?>
</optgroup>
</select>
&nbsp;&nbsp;<input type="submit" name="del_forum" value="Delete"><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="admin_forums.php?action=edit">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">Edit forums</td>
</tr>
<?php
$cur_category = 0;
foreach($forum_list as $cur_forum) // We use foreach instead of each() because we iterate through $forum_list later in the code block
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
print "\t\t".'<tr class="puncon3"><td>'.htmlspecialchars($cur_forum['cat_name']).'</td></tr>'."\n";
$cur_category = $cur_forum['cid'];
}
if ($cur_forum['fid'] != '')
{
?>
<tr class="puncon1">
<td>
<table class="punplain">
<tr>
<td class="punright" style="width: 10%"><b>Position</b></td>
<td style="width: 32%">&nbsp;<input type="text" name="position[<?php print $cur_forum['fid'] ?>]" size="3" maxlength="3" value="<?php print $cur_forum['position'] ?>"></td>
<td class="punright" style="width: 10%" rowspan="2"><b>Options</b></td>
<td style="width: 32%; white-space: nowrap">&nbsp;<input type="checkbox" name="admmod_only[<?php print $cur_forum['fid'] ?>]" value="1"<?php if ($cur_forum['admmod_only'] == '1') print ' checked'; ?>>&nbsp;Admins/moderators only</td>
<td class="puncent" style="width: 16%" rowspan="3"><input type="submit" name="update[<?php print $cur_forum['fid'] ?>]" value="Update"></td>
</tr>
<tr>
<td class="punright"><b>Name</b></td>
<td>&nbsp;<input type="text" name="forum_name[<?php print $cur_forum['fid'] ?>]" size="35" maxlength="80" value="<?php print htmlspecialchars($cur_forum['forum_name']) ?>"></td>
<td style="white-space: nowrap">&nbsp;<input type="checkbox" name="closed[<?php print $cur_forum['fid'] ?>]" value="1"<?php if ($cur_forum['closed'] == '1') print ' checked'; ?>>&nbsp;Closed</td>
</tr>
<tr>
<td class="punright">Description<br>(HTML)</td>
<td>&nbsp;<textarea name="forum_desc[<?php print $cur_forum['fid'] ?>]" rows="3" cols="50"><?php print htmlspecialchars($cur_forum['forum_desc']) ?></textarea></td>
<td class="punright"><b>Category</b></td>
<td>
&nbsp;<select name="cat_id[<?php print $cur_forum['fid'] ?>]">
<?php
$cur_category2 = 0;
@reset($forum_list);
foreach ($forum_list as $cur_forum2)
{
if ($cur_forum2['cid'] != $cur_category2) // A new category since last iteration?
{
$selected = ($cur_forum['cid'] == $cur_forum2['cid']) ? ' selected' : '';
print "\t\t\t\t\t\t\t\t".'<option value="'.$cur_forum2['cid'].'"'.$selected.'>'.htmlspecialchars($cur_forum2['cat_name']).'</option>'."\n";
$cur_category2 = $cur_forum2['cid'];
}
}
?>
</select>
</td>
</tr>
</table>
</td>
</tr>
<?php
}
}
?>
<tr>
<td class="puncon2cent"><br><input type="submit" name="updateall" value="Update all"><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

142
admin_index.php Normal file
View File

@ -0,0 +1,142 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 1)
message($lang_common['No permission']);
// Get the server load averages
$output = @exec('uptime');
if (preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/i', $output, $server_load))
$server_load = $server_load[1].' '.$server_load[2].' '.$server_load[3];
else
$server_load = 'Not available.';
// Get number of current visitors
$result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error());
$num_online = $db->result($result, 0);
// Get the database system version
$result = $db->query('SELECT version()') or error('Unable to fetch version info', __FILE__, __LINE__, $db->error());
$db_version = $db->result($result, 0);
if ($db_type == 'mysql')
{
$db_version = 'MySQL '.$db_version;
// Calculate total db size/row count (MySQL only)
$result = $db->query('SHOW TABLE STATUS FROM '.$db_name) or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
$num_tables = $db->num_rows($result);
$total_records = 0;
$total_size = 0;
while ($num_tables--)
{
$status = $db->fetch_row($result);
$total_records += (int)$status[3];
$total_size += (int)$status[5] + (int)$status[7];
}
$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';
}
$page_title = htmlspecialchars($options['board_title']).' / Admin';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu();
else
moderator_menu();
?>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">Forum administation</td>
</tr>
<tr>
<td class="puncon2">
Welcome to the PunBB administration control panel. From here you can control vital aspects of the forum. Depending on whether you are an administrator or a moderator you can<br><br>
&nbsp;- organize categories and forums.<br>
&nbsp;- set forum-wide options and preferences.<br>
&nbsp;- control permissions for users and guests.<br>
&nbsp;- view IP statistics for users.<br>
&nbsp;- ban users.<br>
&nbsp;- censor words.<br>
&nbsp;- set up user ranks.<br>
&nbsp;- prune old posts.<br>
&nbsp;- handle post reports.<br><br>
</td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Statistics</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Current version&nbsp;&nbsp;</td>
<td class="puncon2">
&nbsp;PunBB <?php print $options['cur_version'] ?><br><br>
&nbsp;Developed by Rickard Andersson<br>
&nbsp;&copy Copyright 2002, 2003 Rickard Andersson
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Unix load averages&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<?php print $server_load ?> - <?php print $num_online ?> users online</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Environment&nbsp;&nbsp;</td>
<td class="puncon2">
&nbsp;PHP <?php print phpversion() ?><br>
&nbsp;<?php print $db_version."\n" ?>
<?php if (isset($total_records) && isset($total_size)): ?> <br><br>&nbsp;Rows: <?php print $total_records ?><br>
&nbsp;Size: <?php print $total_size."\n" ?>
<?php endif; ?>
</td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

169
admin_maintenance.php Normal file
View File

@ -0,0 +1,169 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
// Tell common.php that we don't want output buffering
define('PUN_DISABLE_BUFFERING', 1);
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 2)
message($lang_common['No permission']);
if (isset($_GET['req_per_page']) && isset($_GET['req_start_at']))
{
confirm_referer('admin_maintenance.php');
$per_page = intval($_GET['req_per_page']);
$start_at = intval($_GET['req_start_at']);
if (empty($per_page) || empty($start_at))
message($lang_common['Bad request']);
// If this is the first cycle of posts we empty the search index before we proceed
if (isset($_GET['empty_index']))
{
$db->query('TRUNCATE TABLE '.$db->prefix.'search_matches') or error('Unable to empty search index match table', __FILE__, __LINE__, $db->error());
$db->query('TRUNCATE TABLE '.$db->prefix.'search_words') or error('Unable to empty search index words table', __FILE__, __LINE__, $db->error());
}
$end_at = $start_at + $per_page;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php print htmlspecialchars($options['board_title']) ?> / Rebuilding search index...</title>
<style type="text/css">
body {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333;
background-color: #FFFFFF
}
</style>
</head>
<body>
Rebuilding index... This might be a good time to put on some coffee :-)<br><br>
<?php
require 'include/searchidx.php';
// Fetch posts to process
$result = $db->query('SELECT DISTINCT t.id, p.id, p.message FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.id>='.$start_at.' AND t.id<'.$end_at.' ORDER BY t.id') or error('Unable to fetch topic/post info', __FILE__, __LINE__, $db->error());
while ($cur_post = $db->fetch_row($result))
{
if ($cur_post[0] <> $cur_topic)
{
// Fetch subject and ID of first post in topic
$result2 = $db->query('SELECT p.id, t.subject, MIN(p.posted) AS first FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE t.id='.$cur_post[0].' GROUP BY p.id, t.subject ORDER BY first LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
list($first_post, $subject) = $db->fetch_row($result2);
$cur_topic = $cur_post[0];
}
print 'Processing post <b>'.$cur_post[1].'</b> in topic <b>'.$cur_post[0].'</b><br>'."\n";
flush();
if ($cur_post[1] == $first_post) // This is the "topic post" so we have to index the subject as well
update_search_index('post', $cur_post[1], $cur_post[2], $subject);
else
update_search_index('post', $cur_post[1], $cur_post[2]);
}
// Check if there is more work to do
$result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE id>'.$end_at) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
print '<script type="text/javascript">window.location="admin_maintenance.php?req_per_page='.$per_page.'&req_start_at='.$end_at.'"</script>';
else
print '<script type="text/javascript">window.location="admin_maintenance.php"</script>';
$db->close();
exit;
}
else
{
// Get the first post ID from the db
$result = $db->query('SELECT id FROM '.$db->prefix.'topics ORDER BY id LIMIT 1') or error('Unable to create category', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
$first_id = $db->result($result, 0);
$page_title = htmlspecialchars($options['board_title']).' / Admin / Maintenance';
$validate_form = true;
$form_name = 'rebuild';
$focus_element = 'req_per_page';
require 'header.php';
admin_menu('maintenance');
?>
<form method="get" action="admin_maintenance.php" id="rebuild" onsubmit="return process_form(this)">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Search index</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Rebuild search index&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td colspan="3">If you switched language while there were posts in the database, you should rebuild the search index (to remove stopwords). For best performance you should put the forum in maintenance mode during rebuilding. <b>Rebuilding the search index can take a long time and will increase server load during the rebuild process!</b></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Topics per cycle</b><br>The number of topics to process per pageview. E.g. if you were to enter 100, one hundred topics would be processed and then the page would refresh. This is to prevent the script from timing out during the rebuild process.</td>
<td style="width: 35%"><input type="text" name="req_per_page" size="7" maxlength="7" value="100" tabindex="1"></td>
<td style="width: 30%" rowspan="3"><input type="submit" name="rebuild_index" value="Rebuild index" tabindex="3"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Topic ID to start at</b><br>The topic ID to start rebuilding at. It's default value is the first available ID in the database. Normally you wouldn't want to change this.</td>
<td style="width: 35%"><input type="text" name="req_start_at" size="7" maxlength="7" value="<?php print (isset($first_id)) ? $first_id : 0 ?>" tabindex="2"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Empty index</b><br>Select this if you want the search index to be emptied before rebuilding (see below).</td>
<td style="width: 35%"><input type="checkbox" name="empty_index" value="1" checked></td>
</tr>
<tr>
<td colspan="3">Once the process has completed you will be redirected back to this page. It is highly recommended that you have JavaScript enabled in your browser during rebuilding (for automatic redirect after a cycle has completed). If you are forced to abort the rebuild process, make a note of the last processed topic ID and enter that ID+1 in "Topic ID to start at" when/if you want to continue ("Empty index" must not be selected).</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

426
admin_options.php Normal file
View File

@ -0,0 +1,426 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 2)
message($lang_common['No permission']);
if (isset($_POST['form_sent']))
{
// Lazy referer check (in case base_url isn't correct)
if (!preg_match('#/admin_options\.php#i', $_SERVER['HTTP_REFERER']))
message($lang_common['Bad referer'].' <a href="mailto:'.$options['admin_email'].'">'.$options['admin_email'].'</a>.');
$form = array_map('trim', $_POST['form']);
if ($form['board_title'] == '')
message('You must enter a board title.');
require 'include/email.php';
$form['admin_email'] = strtolower($form['admin_email']);
if (!is_valid_email($form['admin_email']))
message('The admin e-mail address you entered is invalid.');
$form['webmaster_email'] = strtolower($form['webmaster_email']);
if (!is_valid_email($form['webmaster_email']))
message('The webmaster e-mail address you entered is invalid.');
if ($form['mailing_list'] != '')
$form['mailing_list'] = strtolower(preg_replace('/[\s]/', '', $form['mailing_list']));
// Make sure all newlines are \n and not \r\n or \r
if ($form['rules_message'] != '')
$form['rules_message'] = str_replace("\r", "\n", str_replace("\r\n", "\n", $form['rules_message']));
if ($form['rules'] == '1' && $form['rules_message'] == '')
$form['rules'] = '0';
// Make sure base_url doesn't end with a slash
if (substr($form['base_url'], -1) == '/')
$form['base_url'] = substr($form['base_url'], 0, -1);
// Make sure avatars_dir doesn't end with a slash
if (substr($form['avatars_dir'], -1) == '/')
$form['avatars_dir'] = substr($form['avatars_dir'], 0, -1);
if ($form['maintenance_message'] != '')
$form['maintenance_message'] = str_replace("\r", "\n", str_replace("\r\n", "\n", $form['maintenance_message']));
else
$form['maintenance_message'] = 'The forums are temporarily down for maintenance. Please try again in a few minutes.\n\n/Administrator';
foreach ($form as $key => $input)
{
$value = ($input != '') ? $value = '\''.escape($input).'\'' : 'NULL';
$temp[] = $key.'='.$value;
}
$db->query('UPDATE '.$db->prefix.'options SET '.implode(',', $temp)) or error('Unable to update options', __FILE__, __LINE__, $db->error());
redirect('admin_options.php', 'Options updated. Redirecting ...');
}
$page_title = htmlspecialchars($options['board_title']).' / Admin / Options';
$validate_form = true;
$form_name = 'update_options';
require 'header.php';
admin_menu('options');
?>
<form method="post" action="admin_options.php?action=foo" id="update_options" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Options</td>
</tr>
<tr>
<td class="puncon2cent" colspan="2"><br><input type="submit" name="submit" value="Submit"><br><br></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Title and description&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Board title</b><br>The title of this bulletin board (shown at the top of every page). This field may <b>not</b> contain HTML.</td>
<td style="width: 65%"><input type="text" name="form[board_title]" size="40" maxlength="255" value="<?php print htmlspecialchars($options['board_title']) ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Board description</b><br>A short description of this bulletin board (shown at the top of every page). This field may contain HTML.</td>
<td style="width: 65%"><input type="text" name="form[board_desc]" size="60" maxlength="255" value="<?php print htmlspecialchars($options['board_desc']) ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Time and timeouts&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Server timezone</b><br>The timezone for the server.</td>
<td style="width: 65%">
<select name="form[server_timezone]">
<option value="-12"<?php if ($options['server_timezone'] == -12 ) print ' selected' ?>>-12</option>
<option value="-11"<?php if ($options['server_timezone'] == -11) print ' selected' ?>>-11</option>
<option value="-10"<?php if ($options['server_timezone'] == -10) print ' selected' ?>>-10</option>
<option value="-9"<?php if ($options['server_timezone'] == -9 ) print ' selected' ?>>-09</option>
<option value="-8"<?php if ($options['server_timezone'] == -8 ) print ' selected' ?>>-08 PST</option>
<option value="-7"<?php if ($options['server_timezone'] == -7 ) print ' selected' ?>>-07 MST</option>
<option value="-6"<?php if ($options['server_timezone'] == -6 ) print ' selected' ?>>-06 CST</option>
<option value="-5"<?php if ($options['server_timezone'] == -5 ) print ' selected' ?>>-05 EST</option>
<option value="-4"<?php if ($options['server_timezone'] == -4 ) print ' selected' ?>>-04 AST</option>
<option value="-3"<?php if ($options['server_timezone'] == -3 ) print ' selected' ?>>-03 ADT</option>
<option value="-2"<?php if ($options['server_timezone'] == -2 ) print ' selected' ?>>-02</option>
<option value="-1"<?php if ($options['server_timezone'] == -1) print ' selected' ?>>-01</option>
<option value="0"<?php if ($options['server_timezone'] == 0) print ' selected' ?>>00 GMT</option>
<option value="1"<?php if ($options['server_timezone'] == 1) print ' selected' ?>>+01 CET</option>
<option value="2"<?php if ($options['server_timezone'] == 2 ) print ' selected' ?>>+02</option>
<option value="3"<?php if ($options['server_timezone'] == 3 ) print ' selected' ?>>+03</option>
<option value="4"<?php if ($options['server_timezone'] == 4 ) print ' selected' ?>>+04</option>
<option value="5"<?php if ($options['server_timezone'] == 5 ) print ' selected' ?>>+05</option>
<option value="6"<?php if ($options['server_timezone'] == 6 ) print ' selected' ?>>+06</option>
<option value="7"<?php if ($options['server_timezone'] == 7 ) print ' selected' ?>>+07</option>
<option value="8"<?php if ($options['server_timezone'] == 8 ) print ' selected' ?>>+08</option>
<option value="9"<?php if ($options['server_timezone'] == 9 ) print ' selected' ?>>+09</option>
<option value="10"<?php if ($options['server_timezone'] == 10) print ' selected' ?>>+10</option>
<option value="11"<?php if ($options['server_timezone'] == 11) print ' selected' ?>>+11</option>
<option value="12"<?php if ($options['server_timezone'] == 12 ) print ' selected' ?>>+12</option>
<option value="13"<?php if ($options['server_timezone'] == 13 ) print ' selected' ?>>+13</option>
</select>
</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Time format</b><br>The format string for representing time. See <a href="http://www.php.net/manual/en/function.date.php" target="_blank">here</a> for formatting options.</td>
<td style="width: 65%"><input type="text" name="form[time_format]" size="25" maxlength="25" value="<?php print $options['time_format'] ?>">&nbsp;&nbsp;Current format: <?php print date($options['time_format']) ?></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Date format</b><br>The format string for representing date. See <a href="http://www.php.net/manual/en/function.date.php" target="_blank">here</a> for formatting options.</td>
<td style="width: 65%"><input type="text" name="form[date_format]" size="25" maxlength="25" value="<?php print $options['date_format'] ?>">&nbsp;&nbsp;Current format: <?php print date($options['date_format']) ?></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Cookie timeout</b><br>Number of seconds to wait before writing a new cookie (primarily affects new message indicators).</td>
<td style="width: 65%"><input type="text" name="form[timeout_cookie]" size="5" maxlength="5" value="<?php print $options['timeout_cookie'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Online timeout</b><br>Number of seconds a user can be idle before being removed from the online users list.</td>
<td style="width: 65%"><input type="text" name="form[timeout_online]" size="5" maxlength="5" value="<?php print $options['timeout_online'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Redirect time</b><br>Number of seconds to wait when redirecting.</td>
<td style="width: 65%"><input type="text" name="form[redirect_delay]" size="3" maxlength="3" value="<?php print $options['redirect_delay'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Flood interval</b><br>Number of seconds that users have to wait between posts. Set to 0 to disable.</td>
<td style="width: 65%"><input type="text" name="form[flood_interval]" size="4" maxlength="4" value="<?php print $options['flood_interval'] ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Display&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Smilies</b><br>Convert a series of smilies to small icons.</td>
<td style="width: 65%"><input type="radio" name="form[smilies]" value="1"<?php if ($options['smilies'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[smilies]" value="0"<?php if ($options['smilies'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Smilies in signatures</b><br>Convert a series of smilies to small icons in user signatures.</td>
<td style="width: 65%"><input type="radio" name="form[smilies_sig]" value="1"<?php if ($options['smilies_sig'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[smilies_sig]" value="0"<?php if ($options['smilies_sig'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Make clickable links</b><br>When enabled, PunBB will automatically detect any URL's in posts and make them clickable hyperlinks.</td>
<td style="width: 65%"><input type="radio" name="form[make_links]" value="1"<?php if ($options['make_links'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[make_links]" value="0"<?php if ($options['make_links'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Show user post count</b><br>Show the number of posts a user has made (affects topic view, profile and userlist).</td>
<td style="width: 65%"><input type="radio" name="form[show_post_count]" value="1"<?php if ($options['show_post_count'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[show_post_count]" value="0"<?php if ($options['show_post_count'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Default style</b><br>This is the default style used if the visitor is a guest or a user that hasn't changed from the default in his/her profile.</td>
<td style="width: 65%">
<select name="form[default_style]">
<?php
$d = dir('style');
while (($entry = $d->read()) !== false)
{
if (substr($entry, strlen($entry)-4) == '.css')
$styles[] = substr($entry, 0, strlen($entry)-4);
}
$d->close();
foreach ($styles as $temp)
{
if ($options['default_style'] == $temp)
print "\t\t\t\t\t\t\t\t<option value=\"$temp\" selected>".str_replace('_', ' ', $temp)."</option>\n";
else
print "\t\t\t\t\t\t\t\t<option value=\"$temp\">".str_replace('_', ' ', $temp)."</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Topic review</b><br>Maximum number of posts to display when posting (newest first). 0 to disable.</td>
<td style="width: 65%"><input type="text" name="form[topic_review]" size="3" maxlength="3" value="<?php print $options['topic_review'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Topics per page default</b><br>The default number of topics to display per page in a forum. Users can personalize this setting.</td>
<td style="width: 65%"><input type="text" name="form[disp_topics_default]" size="3" maxlength="3" value="<?php print $options['disp_topics_default'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Posts per page default</b><br>The default number of posts to display per page in a topic. Users can personalize this setting.</td>
<td style="width: 65%"><input type="text" name="form[disp_posts_default]" size="3" maxlength="3" value="<?php print $options['disp_posts_default'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Indent size</b><br>If set to 8, a regular tab will be used when displaying text within the [code][/code] tag. Otherwise this many spaces will be used to indent the text.</td>
<td><input type="text" name="form[indent_num_spaces]" size="3" maxlength="3" value="<?php print $options['indent_num_spaces'] ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Features&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Quick post</b><br>When enabled, PunBB will add a quick post form at the bottom of topics. This way users can post directly from the topic view.</td>
<td style="width: 65%"><input type="radio" name="form[quickpost]" value="1"<?php if ($options['quickpost'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[quickpost]" value="0"<?php if ($options['quickpost'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Users online</b><br>Display a list of users current online on the index page.</td>
<td style="width: 65%"><input type="radio" name="form[users_online]" value="1"<?php if ($options['users_online'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[users_online]" value="0"<?php if ($options['users_online'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><a name="censoring"><b>Censor words</b></a><br>Enable this to censor specific words in the forum. See <a href="admin_censoring.php">Censoring</a> for more info.</td>
<td style="width: 65%"><input type="radio" name="form[censoring]" value="1"<?php if ($options['censoring'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[censoring]" value="0"<?php if ($options['censoring'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><a name="ranks"><b>User ranks</b></a><br>Enable this to use user ranks. See <a href="admin_ranks.php">Ranks</a> for more info.</td>
<td style="width: 65%"><input type="radio" name="form[ranks]" value="1"<?php if ($options['ranks'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[ranks]" value="0"<?php if ($options['ranks'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>User has posted earlier</b><br>This feature displays a dot in front of topics in viewforum.php in case the currently logged in user has posted in that topic earlier. Disable if you are experiencing high server load.</td>
<td style="width: 65%"><input type="radio" name="form[show_dot]" value="1"<?php if ($options['show_dot'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[show_dot]" value="0"<?php if ($options['show_dot'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Quick jump</b><br>Enable the quick jump (jump to forum) drop list.</td>
<td style="width: 65%"><input type="radio" name="form[quickjump]" value="1"<?php if ($options['quickjump'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[quickjump]" value="0"<?php if ($options['quickjump'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>GZip output</b><br>If enabled, PunBB will gzip the output sent to browsers. This will reduce bandwidth usage, but use a little more CPU. This feature requires that PHP is configured with zlib (--with-zlib). Note: If you already have the Apache module mod_gzip set up to compress PHP scripts, you should disable this feature.</td>
<td style="width: 65%"><input type="radio" name="form[gzip]" value="1"<?php if ($options['gzip'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[gzip]" value="0"<?php if ($options['gzip'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Reports&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Report method</b><br>Select the method for handling topic/post reports. You can choose whether topic/post reports should be handled by the internal report system, e-mailed to the addresses on the mailing list (see below) or both.</td>
<td style="width: 65%"><input type="radio" name="form[report_method]" value="0"<?php if ($options['report_method'] == '0') print ' checked' ?>>&nbsp;Internal&nbsp;&nbsp;&nbsp;<input type="radio" name="form[report_method]" value="1"<?php if ($options['report_method'] == '1') print ' checked' ?>>&nbsp;E-mail&nbsp;&nbsp;&nbsp;<input type="radio" name="form[report_method]" value="2"<?php if ($options['report_method'] == '2') print ' checked' ?>>&nbsp;Both</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Mailing list</b><br>A comma separatad list of subscribers. The people on this list are the recipients of topic/post reports (see above).</td>
<td style="width: 65%"><textarea name="form[mailing_list]" rows="5" cols="55"><?php print htmlspecialchars($options['mailing_list']) ?></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Avatars&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Use avatars</b><br>When enabled, users will be able to upload an avatar which will be displayed under their title/rank.</td>
<td style="width: 65%"><input type="radio" name="form[avatars]" value="1"<?php if ($options['avatars'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[avatars]" value="0"<?php if ($options['avatars'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Upload directory</b><br>The upload directory for avatars (relative to the PunBB root directory). PHP must have write permissions to this directory.</td>
<td style="width: 65%"><input type="text" name="form[avatars_dir]" size="35" maxlength="50" value="<?php print $options['avatars_dir'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Max width</b><br>The maximum allowed width of avatars in pixels (60 is recommended).</td>
<td style="width: 65%"><input type="text" name="form[avatars_width]" size="5" maxlength="5" value="<?php print $options['avatars_width'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Max height</b><br>The maximum allowed height of avatars in pixels (60 is recommended).</td>
<td style="width: 65%"><input type="text" name="form[avatars_height]" size="5" maxlength="5" value="<?php print $options['avatars_height'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Max size</b><br>The maximum allowed size of avatars in bytes (10240 is recommended).</td>
<td style="width: 65%"><input type="text" name="form[avatars_size]" size="6" maxlength="6" value="<?php print $options['avatars_size'] ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Search&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Search enabled</b><br>When disabled, regular users will not be able to use the search feature. "Show new posts since last visit" and "Show posts by this user" will still work though.</td>
<td style="width: 65%"><input type="radio" name="form[search]" value="1"<?php if ($options['search'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[search]" value="0"<?php if ($options['search'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Search all forums</b><br>When disabled, searches will only be allowed in one forum at a time. Disable if server load is high due to excessive searching.</td>
<td style="width: 65%"><input type="radio" name="form[search_all_forums]" value="1"<?php if ($options['search_all_forums'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[search_all_forums]" value="0"<?php if ($options['search_all_forums'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">E-mail&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Base URL</b><br>The complete URL of the forum without trailing slash (i.e. http://www.mydomain.com/forums). This <b>must</b> be correct in order for all admin and moderator features to work. If you get "Bad referer" errors, it's probably incorrect.</td>
<td style="width: 65%"><input type="text" name="form[base_url]" size="60" maxlength="100" value="<?php print $options['base_url'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Admin e-mail</b><br>The e-mail address of the forum administrator.</td>
<td style="width: 65%"><input type="text" name="form[admin_email]" size="50" maxlength="50" value="<?php print $options['admin_email'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Webmaster e-mail</b><br>This is the address that all e-mails sent by the forum will be addressed from.</td>
<td style="width: 65%"><input type="text" name="form[webmaster_email]" size="50" maxlength="50" value="<?php print $options['webmaster_email'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Subscriptions</b><br>Enable users to subscribe to topics (recieve e-mail when someone replies).</td>
<td style="width: 65%"><input type="radio" name="form[subscriptions]" value="1"<?php if ($options['subscriptions'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[subscriptions]" value="0"<?php if ($options['subscriptions'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>SMTP server address</b><br>The address of an external SMTP server to send e-mails with. Leave blank to use the local mail program.</td>
<td style="width: 65%"><input type="text" name="form[smtp_host]" size="30" maxlength="100" value="<?php print $options['smtp_host'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>SMTP username</b><br>Username for SMTP server. Only enter a username if it is required by the SMTP server (most servers <b>don't</b> require authentication).</td>
<td style="width: 65%"><input type="text" name="form[smtp_user]" size="25" maxlength="25" value="<?php print $options['smtp_user'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>SMTP password</b><br>Password for SMTP server. Only enter a password if it is required by the SMTP server (most servers <b>don't</b> require authentication).</td>
<td style="width: 65%"><input type="text" name="form[smtp_pass]" size="25" maxlength="25" value="<?php print $options['smtp_pass'] ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Registration&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Allow new registrations</b><br>Controls whether this forum accepts new registrations. Disable only under special circumstances.</td>
<td style="width: 65%"><input type="radio" name="form[regs_allow]" value="1"<?php if ($options['regs_allow'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[regs_allow]" value="0"<?php if ($options['regs_allow'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Validate registrations</b><br>When enabled, users are e-mailed a random password when they register. They can then log in and change the password in their profile if they see fit. This feature also requires users to validate new e-mail addresses if they choose to change from the one they registered with. This is an effective way of avoiding registration abuse and making sure that all users have "correct" e-mail addresses in their profiles.</td>
<td style="width: 65%"><input type="radio" name="form[regs_validate]" value="1"<?php if ($options['regs_validate'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[regs_validate]" value="0"<?php if ($options['regs_validate'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Use forum rules</b><br>When enabled, users must agree to a set of rules when registering (enter text below). The rules will always be available through a link in the navigation table at the top of every page.</td>
<td style="width: 65%"><input type="radio" name="form[rules]" value="1"<?php if ($options['rules'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[rules]" value="0"<?php if ($options['rules'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Rules</b><br>Here you can enter any rules or other information that the user must review and accept when registering. If you enabled rules above you have to enter something here, otherwise it will be disabled. This text will not be parsed like regular posts and thus may contain HTML.</td>
<td style="width: 65%"><textarea name="form[rules_message]" rows="10" cols="55"><?php print htmlspecialchars($options['rules_message']) ?></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Maintenance&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><a name="maintenance"><b>Maintenance mode</b></a><br>When enabled, the board will only be available to administrators. This should be used if the board needs to taken down temporarily for maintenance. WARNING! Do not log out when the board is in maintenance mode. You will not be able to login again.</td>
<td style="width: 65%"><input type="radio" name="form[maintenance]" value="1"<?php if ($options['maintenance'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[maintenance]" value="0"<?php if ($options['maintenance'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Message</b><br>The message that will be displayed to users when the board is in maintenance mode. If left blank a default message will be used. This text will not be parsed like regular posts and thus may contain HTML.</td>
<td style="width: 65%"><textarea name="form[maintenance_message]" rows="5" cols="55"><?php print htmlspecialchars($options['maintenance_message']) ?></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon2cent" colspan="2"><br><input type="submit" name="submit" value="Submit"><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

205
admin_permissions.php Normal file
View File

@ -0,0 +1,205 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 2)
message($lang_common['No permission']);
if (isset($_POST['form_sent']))
{
confirm_referer('admin_permissions.php');
foreach ($_POST['form'] as $key => $input)
{
if (trim($input ) != '')
$value = '\''.escape($input).'\'';
else
$value = 'NULL';
$temp[] = $key.'='.$value;
}
$db->query('UPDATE '.$db->prefix.'permissions SET '.implode(',', $temp)) or error('Unable to update permissions', __FILE__, __LINE__, $db->error());
redirect('admin_permissions.php', 'Permissions updated. Redirecting ...');
}
$page_title = htmlspecialchars($options['board_title']).' / Admin / Permissions';
require 'header.php';
admin_menu('permissions');
?>
<form method="post" action="admin_permissions.php">
<input type="hidden" name="form_sent" value="1">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Permissions</td>
</tr>
<tr>
<td class="puncon2cent" colspan="2"><br><input type="submit" name="submit" value="Submit"><br><br></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Guests&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Guests may read forum</b><br>Allow guests (not registered users) to read the forum.</td>
<td style="width: 65%"><input type="radio" name="form[guests_read]" value="1"<?php if ($permissions['guests_read'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[guests_read]" value="0"<?php if ($permissions['guests_read'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Guests may post replies</b><br>Allow guests (not registered users) to post replies to topics in the forum.</td>
<td style="width: 65%"><input type="radio" name="form[guests_post]" value="1"<?php if ($permissions['guests_post'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[guests_post]" value="0"<?php if ($permissions['guests_post'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Guests may post topics</b><br>Allow guests (not registered users) to post new topics.</td>
<td style="width: 65%"><input type="radio" name="form[guests_post_topic]" value="1"<?php if ($permissions['guests_post_topic'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[guests_post_topic]" value="0"<?php if ($permissions['guests_post_topic'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Guests may use search</b><br>Allow guests (not registered users) to use the forum search engine.</td>
<td style="width: 65%"><input type="radio" name="form[guests_search]" value="1"<?php if ($permissions['guests_search'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[guests_search]" value="0"<?php if ($permissions['guests_search'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Users&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Users may post replies</b><br>Allow users to post replies to topics in the forum.</td>
<td style="width: 65%"><input type="radio" name="form[users_post]" value="1"<?php if ($permissions['users_post'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[users_post]" value="0"<?php if ($permissions['users_post'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Users may post topics</b><br>Allow users to post new topics.</td>
<td style="width: 65%"><input type="radio" name="form[users_post_topic]" value="1"<?php if ($permissions['users_post_topic'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[users_post_topic]" value="0"<?php if ($permissions['users_post_topic'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Users may edit posts</b><br>Allow users to edit their own posts.</td>
<td style="width: 65%"><input type="radio" name="form[users_edit_post]" value="1"<?php if ($permissions['users_edit_post'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[users_edit_post]" value="0"<?php if ($permissions['users_edit_post'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Users may delete posts</b><br>Allow users to delete their own posts.</td>
<td style="width: 65%"><input type="radio" name="form[users_del_post]" value="1"<?php if ($permissions['users_del_post'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[users_del_post]" value="0"<?php if ($permissions['users_del_post'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Users may delete topics</b><br>Allow users to delete their own topics.</td>
<td style="width: 65%"><input type="radio" name="form[users_del_topic]" value="1"<?php if ($permissions['users_del_topic'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[users_del_topic]" value="0"<?php if ($permissions['users_del_topic'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Users may set title</b><br>Allow users to set their title.</td>
<td style="width: 65%"><input type="radio" name="form[users_set_title]" value="1"<?php if ($permissions['users_set_title'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[users_set_title]" value="0"<?php if ($permissions['users_set_title'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Posting&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>HTML</b><br>Allow HTML in posts (not recommended).</td>
<td style="width: 65%"><input type="radio" name="form[message_html]" value="1"<?php if ($permissions['message_html'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[message_html]" value="0"<?php if ($permissions['message_html'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>BBCode</b><br>Allow BBCode in posts (recommended).</td>
<td style="width: 65%"><input type="radio" name="form[message_bbcode]" value="1"<?php if ($permissions['message_bbcode'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[message_bbcode]" value="0"<?php if ($permissions['message_bbcode'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Image tag</b><br>Allow the BBCode [img][/img] tag in posts.</td>
<td style="width: 65%"><input type="radio" name="form[message_img_tag]" value="1"<?php if ($permissions['message_img_tag'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[message_img_tag]" value="0"<?php if ($permissions['message_img_tag'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>All caps message</b><br>Allow a message to contain only capital letters.</td>
<td style="width: 65%"><input type="radio" name="form[message_all_caps]" value="1"<?php if ($permissions['message_all_caps'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[message_all_caps]" value="0"<?php if ($permissions['message_all_caps'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>All caps subject</b><br>Allow a subject to contain only capital letters.</td>
<td style="width: 65%"><input type="radio" name="form[subject_all_caps]" value="1"<?php if ($permissions['subject_all_caps'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[subject_all_caps]" value="0"<?php if ($permissions['subject_all_caps'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Signatures&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>HTML in signatures</b><br>Allow HTML in user signatures (not recommended).</td>
<td style="width: 65%"><input type="radio" name="form[sig_html]" value="1"<?php if ($permissions['sig_html'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[sig_html]" value="0"<?php if ($permissions['sig_html'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>BBCodes in signatures</b><br>Allow BBCodes in user signatures.</td>
<td style="width: 65%"><input type="radio" name="form[sig_bbcode]" value="1"<?php if ($permissions['sig_bbcode'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[sig_bbcode]" value="0"<?php if ($permissions['sig_bbcode'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Image tag in signatures</b><br>Allow the BBCode [img][/img] tag in user signatures (not recommended).</td>
<td style="width: 65%"><input type="radio" name="form[sig_img_tag]" value="1"<?php if ($permissions['sig_img_tag'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[sig_img_tag]" value="0"<?php if ($permissions['sig_img_tag'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>All caps signature</b><br>Allow a signature to contain only capital letter.</td>
<td style="width: 65%"><input type="radio" name="form[sig_all_caps]" value="1"<?php if ($permissions['sig_all_caps'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[sig_all_caps]" value="0"<?php if ($permissions['sig_all_caps'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Maximum signature length</b><br>The maximum number of characters a user signature may contain.</td>
<td style="width: 65%"><input type="text" name="form[sig_length]" size="5" maxlength="5" value="<?php print $permissions['sig_length'] ?>"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Maximum signature lines</b><br>The maximum number of lines a user signature may contain.</td>
<td style="width: 65%"><input type="text" name="form[sig_lines]" size="3" maxlength="3" value="<?php print $permissions['sig_lines'] ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Registration&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Allow banned e-mail addresses</b><br>Allow users to register with or change to a banned e-mail address/domain. If left at it's default setting (yes) this action will be allowed, but an alert e-mail will be sent to the mailing list (an effective way of detecting multiple registrations).</td>
<td style="width: 65%"><input type="radio" name="form[allow_banned_email]" value="1"<?php if ($permissions['allow_banned_email'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[allow_banned_email]" value="0"<?php if ($permissions['allow_banned_email'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Allow duplicate e-mail addresses</b><br>Controls whether users should be allowed to register with an e-mail address that another user already has. If allowed, an alert e-mail will be sent to the mailing list if a duplicate is detected.</td>
<td style="width: 65%"><input type="radio" name="form[allow_dupe_email]" value="1"<?php if ($permissions['allow_dupe_email'] == '1') print ' checked' ?>>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="form[allow_dupe_email]" value="0"<?php if ($permissions['allow_dupe_email'] == '0') print ' checked' ?>>&nbsp;No</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon2cent" colspan="2"><br><input type="submit" name="submit" value="Submit"><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

220
admin_prune.php Normal file
View File

@ -0,0 +1,220 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 2)
message($lang_common['No permission']);
if (isset($_GET['action']) || isset($_POST['prune']) || isset($_POST['comply']))
{
if (isset($_POST['comply']))
{
confirm_referer('admin_prune.php');
$prune_from = $_POST['prune_from'];
$prune_days = intval($_POST['prune_days']);
$prune_date = ($prune_days > 0) ? time() - ($prune_days*86400) : -1;
@set_time_limit(0);
if ($prune_from == 'all')
{
$result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
$num_forums = $db->num_rows($result);
for ($i = 0; $i < $num_forums; $i++)
{
$fid = $db->result($result, $i);
prune($fid, $_POST['prune_sticky'], $prune_date); // start transaction
update_forum($fid, PUN_TRANS_END); // end transaction
}
}
else
{
prune($prune_from, $_POST['prune_sticky'], $prune_date); // start transaction
update_forum($prune_from, PUN_TRANS_END); // end transaction
}
// Locate any "orphaned redirect topics" and delete them
$result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT OUTER JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error());
$num_orphans = $db->num_rows($result);
if ($num_orphans)
{
for ($i = 0; $i < $num_orphans; $i++)
$orphans[] = $db->result($result, $i);
$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
}
redirect('admin_prune.php', 'Posts pruned. Redirecting ...');
}
else
{
$prune_days = $_POST['req_prune_days'];
if (preg_match('/[^0-9]/', $prune_days))
message('Days to prune must be a positive integer.');
$prune_date = time() - ($prune_days*86400);
$prune_from = $_POST['prune_from'];
// Concatenate together the query for counting number or topics to prune
$sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date;
if ($_POST['prune_sticky'] == '0')
$sql .= ' AND sticky=\'0\'';
if ($prune_from != 'all')
{
$sql .= ' AND forum_id='.$prune_from;
// Fetch the forum name (just for cosmetic reasons)
$result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$prune_from) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error());
$forum = '"'.$db->result($result, 0).'"';
}
else
$forum = 'all forums';
$result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error());
$num_topics = $db->result($result, 0);
if (!$num_topics)
message('There are no topics that are '.$prune_days.' days old. Please decrease the value of "Days old" and try again.');
$page_title = htmlspecialchars($options['board_title']).' / Admin / Prune';
require 'header.php';
admin_menu('prune');
?>
<form method="post" action="admin_prune.php?action=foo">
<input type="hidden" name="prune_days" value="<?php print $prune_days ?>">
<input type="hidden" name="prune_sticky" value="<?php print $_POST['prune_sticky'] ?>">
<input type="hidden" name="prune_from" value="<?php print $prune_from ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">Confirm prune posts</td>
</tr>
<tr>
<td class="puncon2">
<br>&nbsp;Are you sure that you want to prune all topics older than <?php print $prune_days ?> days from <?php print $forum ?>? (<?php print $num_topics ?> topics)<br><br>
&nbsp;WARNING! Pruning posts deletes them permanently.<br><br>
&nbsp;<input type="submit" name="comply" value=" OK ">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)">Go back</a><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
}
require 'footer.php';
}
else
{
$page_title = htmlspecialchars($options['board_title']).' / Admin / Prune';
$validate_form = true;
$form_name = 'prune';
$focus_element = 'req_prune_days';
require 'header.php';
admin_menu('prune');
?>
<form method="post" action="admin_prune.php?action=foo" id="prune" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Prune old posts</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Prune&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td class="punright" style="width: 35%"><b>Days old</b><br>The number of days "old" a topic must be to be pruned. E.g. if you were to enter 30, every topic that didn't contain a post from up til 30 days ago would be deleted.</td>
<td style="width: 35%"><input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="1"></td>
<td style="width: 30%" rowspan="3"><input type="submit" name="prune" value="Prune" tabindex="3"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Prune sticky topics</b><br>When enabled sticky topics will also be pruned.</td>
<td style="width: 35%"><input type="radio" name="prune_sticky" value="1" checked>&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="prune_sticky" value="0">&nbsp;No</td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Prune from forum</b><br>The forum from which you want to prune posts.</td>
<td style="width: 35%">
<select name="prune_from" tabindex="2">
<option value="all">All forums</option>
<?php
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra.' ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
$num_forums = $db->num_rows($result);
while ($num_forums--)
{
$forum = $db->fetch_assoc($result);
if ($forum['cid'] != $cur_category) // Are we still in the same category?
{
if (!empty($cur_category))
print "\t\t\t\t\t\t\t\t".'</optgroup>'."\n";
print "\t\t\t\t\t\t\t\t".'<optgroup label="'.htmlspecialchars($forum['cat_name']).'">'."\n";
$cur_category = $forum['cid'];
}
print "\t\t\t\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.htmlspecialchars($forum['forum_name']).'</option>'."\n";
}
?>
</optgroup>
</select>
</td>
</tr>
<tr>
<td colspan="3">Use this feature with caution. Pruned posts can <b>never</b> be recovered. For best performance you should put the forum in maintenance mode during pruning.</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

156
admin_ranks.php Normal file
View File

@ -0,0 +1,156 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 2)
message($lang_common['No permission']);
// Add a rank
if (isset($_POST['add_rank']))
{
confirm_referer('admin_ranks.php');
$rank = trim($_POST['new_rank']);
$min_posts = $_POST['new_min_posts'];
if ($rank == '')
message('You must enter a rank title.');
if ($min_posts == '' || preg_match('/[^0-9]/', $min_posts))
message('Minimum posts must be a positive integer value.');
// Make sure there isn't already a rank with the same min_posts value
$result = $db->query('SELECT NULL FROM '.$db->prefix.'ranks WHERE min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
message('There is already a rank with a minimun posts value of '.$min_posts.'.');
$db->query('INSERT INTO '.$db->prefix.'ranks (rank, min_posts) VALUES(\''.escape($rank).'\', '.$min_posts.')') or error('Unable to add rank', __FILE__, __LINE__, $db->error());
redirect('admin_ranks.php', 'Rank added. Redirecting ...');
}
// Update a rank
else if (isset($_POST['update']))
{
confirm_referer('admin_ranks.php');
$id = key($_POST['update']);
$rank = trim($_POST['rank'][$id]);
$min_posts = trim($_POST['min_posts'][$id]);
if ($rank == '')
message('You must enter a rank title.');
if ($min_posts == '' || preg_match('/[^0-9]/', $min_posts))
message('Minimum posts must be a positive integer value.');
$db->query('UPDATE '.$db->prefix.'ranks SET rank=\''.escape($rank).'\', min_posts='.$min_posts.' WHERE id='.$id) or error('Unable to update rank', __FILE__, __LINE__, $db->error());
redirect('admin_ranks.php', 'Rank updated. Redirecting ...');
}
// Remove a rank
else if (isset($_POST['remove']))
{
confirm_referer('admin_ranks.php');
$id = key($_POST['remove']);
$db->query('DELETE FROM '.$db->prefix.'ranks WHERE id='.$id) or error('Unable to delete rank', __FILE__, __LINE__, $db->error());
redirect('admin_ranks.php', 'Rank removed. Redirecting ...');
}
$page_title = htmlspecialchars($options['board_title']).' / Admin / Ranks';
$form_name = 'ranks';
$focus_element = 'new_rank';
require 'header.php';
admin_menu('ranks');
?>
<form method="post" action="admin_ranks.php?action=foo" id="ranks">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Ranks</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Add rank&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td colspan="3">Enter a rank and the minimum number of posts that a user has to have to aquire the rank. Different ranks cannot have the same value for minimum posts. If a title is set for a user, the title will be displayed instead of any rank. <b>User ranks must be enabled in <a href="admin_options.php#ranks">Options</a> for this to have any effect.</b><br><br></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Rank title</b><br>Text to be displayed under username.</td>
<td style="width: 35%"><input type="text" name="new_rank" size="25" maxlength="50" tabindex="1"></td>
<td style="width: 30%" rowspan="2"><input type="submit" name="add_rank" value=" Add " tabindex="3"></td>
</tr>
<tr>
<td class="punright" style="width: 35%"><b>Minimum posts</b><br>The minimum number of posts a user must have to attain this rank.</td>
<td style="width: 35%"><input type="text" name="new_min_posts" size="7" maxlength="7" tabindex="2"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Edit/remove ranks&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellpadding="6">
<tr>
<td>
<?php
$result = $db->query('SELECT id, rank, min_posts FROM '.$db->prefix.'ranks ORDER BY min_posts') or error('Unable to fetch rank list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while ($cur_rank = $db->fetch_assoc($result))
print "\t\t\t\t\t\t\t".'&nbsp;&nbsp;&nbsp;Rank title&nbsp;&nbsp;<input type="text" name="rank['.$cur_rank['id'].']" value="'.$cur_rank['rank'].'" size="25" maxlength="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Minimum posts&nbsp;&nbsp;<input type="text" name="min_posts['.$cur_rank['id'].']" value="'.$cur_rank['min_posts'].'" size="7" maxlength="7">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="update['.$cur_rank['id'].']" value="Update">&nbsp;<input type="submit" name="remove['.$cur_rank['id'].']" value="Remove"><br>'."\n";
}
else
print "\t\t\t\t\t\t\t".'No ranks in list.'."\n";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

146
admin_reports.php Normal file
View File

@ -0,0 +1,146 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 1)
message($lang_common['No permission']);
// Zap a report
if (isset($_POST['zap_id']))
{
confirm_referer('admin_reports.php');
$zap_id = key($_POST['zap_id']);
$result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE id='.$zap_id) or error('Unable to fetch report info', __FILE__, __LINE__, $db->error());
$zapped = $db->result($result, 0);
if ($zapped == '')
$db->query('UPDATE '.$db->prefix.'reports SET zapped='.time().', zapped_by='.$cur_user['id'].' WHERE id='.$zap_id) or error('Unable to zap report', __FILE__, __LINE__, $db->error());
redirect('admin_reports.php', 'Report zapped. Redirecting ...');
}
$page_title = htmlspecialchars($options['board_title']).' / Admin / Reports';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('reports');
else
moderator_menu('reports');
?>
<form method="post" action="admin_reports.php?action=zap">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead"><td colspan="6">New reports</td></tr>
<tr class="puncon3">
<td style="width: 15%">Forum</td>
<td style="width: 20%">Topic</td>
<td>Message</td>
<td style="width: 10%">Reporter</td>
<td style="width: 12%">Created</td>
<td class="puncent" width="6%">Actions</td>
</tr>
<?php
$result = $db->query('SELECT r.id, r.post_id, r.topic_id, r.forum_id, r.reported_by, r.created, r.message, t.subject, f.forum_name, u.username AS reporter FROM '.$db->prefix.'reports AS r INNER JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id INNER JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id WHERE r.zapped IS NULL ORDER BY created DESC') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while ($cur_report = $db->fetch_assoc($result))
{
$reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.htmlspecialchars($cur_report['reporter']).'</a>' : 'N/A';
?>
<tr style="height: 24">
<td class="puncon1"><a href="viewforum.php?id=<?php print $cur_report['forum_id'] ?>"><?php print htmlspecialchars($cur_report['forum_name']) ?></a></td>
<td class="puncon2"><a href="viewtopic.php?id=<?php print $cur_report['topic_id'] ?>"><?php print htmlspecialchars($cur_report['subject']) ?></a></td>
<td class="puncon1"><a href="viewtopic.php?pid=<?php print $cur_report['post_id'].'#'.$cur_report['post_id'] ?>"><?php print str_replace("\n", '<br>', htmlspecialchars($cur_report['message'])) ?></a></td>
<td class="puncon2"><?php print $reporter ?></td>
<td class="puncon1"><?php print format_time($cur_report['created']) ?></td>
<td class="puncon2cent"><input type="submit" name="zap_id[<?php print $cur_report['id'] ?>]" value=" Zap "></td>
</tr>
<?php
}
}
else
print "\t\t".'<tr><td class="puncon1" colspan="6">There are no new reports.</td></tr>'."\n";
?>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead"><td colspan="6">10 last zapped reports</td></tr>
<tr class="puncon3">
<td style="width: 15%">Forum</td>
<td style="width: 20%">Topic</td>
<td>Message</td>
<td style="width: 10%">Reporter</td>
<td style="width: 18%">Zapped</td>
</tr>
<?php
$result = $db->query('SELECT r.id, r.post_id, r.topic_id, r.forum_id, r.reported_by, r.message, r.zapped, r.zapped_by AS zapped_by_id, t.subject, f.forum_name, u.username AS reporter, u2.username AS zapped_by FROM '.$db->prefix.'reports AS r INNER JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id INNER JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id LEFT JOIN '.$db->prefix.'users AS u2 ON r.zapped_by=u2.id WHERE r.zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while ($cur_report = $db->fetch_assoc($result))
{
$reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.htmlspecialchars($cur_report['reporter']).'</a>' : 'N/A';
$zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="profile.php?id='.$cur_report['zapped_by_id'].'">'.htmlspecialchars($cur_report['zapped_by']).'</a>' : 'N/A';
?>
<tr style="height: 24">
<td class="puncon1"><a href="viewforum.php?id=<?php print $cur_report['forum_id'] ?>"><?php print htmlspecialchars($cur_report['forum_name']) ?></a></td>
<td class="puncon2"><a href="viewtopic.php?id=<?php print $cur_report['topic_id'] ?>"><?php print htmlspecialchars($cur_report['subject']) ?></a></td>
<td class="puncon1"><a href="viewtopic.php?pid=<?php print $cur_report['post_id'].'#'.$cur_report['post_id'] ?>"><?php print str_replace("\n", '<br>', htmlspecialchars($cur_report['message'])) ?></a></td>
<td class="puncon2"><?php print $reporter ?></td>
<td class="puncon1"><?php print format_time($cur_report['zapped']).' by '.$zapped_by ?></td>
</tr>
<?php
}
}
else
print "\t".'<tr><td class="puncon1" colspan="6">There are no zapped reports.</td></tr>'."\n";
?>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

490
admin_users.php Normal file
View File

@ -0,0 +1,490 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
require 'include/commonadmin.php';
if ($cur_user['status'] < 1)
message($lang_common['No permission']);
if (isset($_GET['ip_stats']))
{
$ip_stats = intval($_GET['ip_stats']);
if ($ip_stats < 1)
message($lang_common['Bad request']);
$page_title = htmlspecialchars($options['board_title']).' / Admin / Users';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('users');
else
moderator_menu('users');
?>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 19%">IP address</td>
<td class="punhead" style="width: 31%">Hostname</td>
<td class="punhead" style="width: 20%">Last used</td>
<td class="punhead" style="width: 12%">Times found</td>
<td class="punhead" style="width: 18%">Action</td>
</tr>
<?php
$result = $db->query('SELECT poster_ip, posted FROM '.$db->prefix.'posts WHERE poster_id='.$ip_stats.' ORDER BY posted DESC') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$num_posts = $db->num_rows($result);
if ($num_posts)
{
// Fetch the first hit and add it to hit_list
$cur_hit = $db->fetch_row($result);
$hit_list = array($cur_hit[0] => array($cur_hit[1], 1));
// Loop through hits and update hit_list
for ($i = 1; $i < $num_posts; $i++)
{
$cur_hit = $db->fetch_row($result);
if (isset($hit_list[$cur_hit[0]]))
{
$hit_list[$cur_hit[0]][1]++;
if ($cur_hit[1] > $hit_list[$cur_hit[0]][0])
$hit_list[$cur_hit[0]][0] = $cur_hit[1];
}
else
$hit_list[$cur_hit[0]] = array($cur_hit[1], 1);
}
foreach ($hit_list as $key => $value)
{
?>
<tr class="puncon2">
<td><?php print $key ?></td>
<td><?php print gethostbyaddr($key) ?></td>
<td><?php print format_time($value[0]) ?></td>
<td><?php print $value[1] ?></td>
<td><a href="admin_users.php?show_users=<?php print $key ?>">Find more users for this ip</a></td>
</tr>
<?php
}
}
else
print "\t".'<tr class="puncon2"><td colspan="5">There are currently no posts by that user in the forum.</td></tr>'."\n";
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
if (isset($_GET['show_users']))
{
$ip = $_GET['show_users'];
if (!preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip))
message('The supplied IP address is not correctly formatted.');
$page_title = htmlspecialchars($options['board_title']).' / Admin / Users';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('users');
else
moderator_menu('users');
?>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 11%; white-space: nowrap">Username</td>
<td class="punhead" style="width: 21%; white-space: nowrap">E-mail</td>
<td class="punhead" style="width: 13%; white-space: nowrap">Title</td>
<td class="punhead" style="width: 10%; white-space: nowrap">Registered</td>
<td class="punhead" style="width: 10%; white-space: nowrap">Last post</td>
<td class="punhead" style="width: 5%; white-space: nowrap">Posts</td>
<td class="punhead" style="width: 14%">Admin note</td>
<td class="punhead" style="white-space: nowrap">Actions</td>
</tr>
<?php
$result = $db->query('SELECT DISTINCT poster_id, poster FROM '.$db->prefix.'posts WHERE poster_ip=\''.escape($ip).'\' ORDER BY poster DESC') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$num_posts = $db->num_rows($result);
if ($num_posts)
{
// Loop through users and print out some info
for ($i = 0; $i < $num_posts; $i++)
{
list($poster_id, $poster) = $db->fetch_row($result);
$result2 = $db->query('SELECT id, username, email, title, num_posts, status, last_post, registered, admin_note FROM '.$db->prefix.'users WHERE id>1 AND id='.$poster_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
if (($user_data = $db->fetch_assoc($result2)))
{
$user_title = get_title($user_data);
$actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">View IP stats</a> - <a href="search.php?action=show_user&amp;user_id='.$user_data['id'].'">Show posts</a>';
?>
<tr class="puncon2">
<td style="white-space: nowrap"><?php print '<a href="profile.php?id='.$user_data['id'].'">'.htmlspecialchars($user_data['username']).'</a>' ?></td>
<td style="white-space: nowrap"><a href="mailto:<?php print $user_data['email'] ?>"><?php print $user_data['email'] ?></a></td>
<td style="white-space: nowrap"><?php print $user_title ?></td>
<td style="white-space: nowrap"><?php print format_time($user_data['registered'], true) ?></td>
<td style="white-space: nowrap"><?php print format_time($user_data['last_post'], true) ?></td>
<td style="white-space: nowrap"><?php print $user_data['num_posts'] ?></td>
<td><?php print ($user_data['admin_note'] != '') ? $user_data['admin_note'] : '&nbsp;' ?></td>
<td style="white-space: nowrap"><?php print $actions ?></td>
</tr>
<?php
}
else
{
?>
<tr class="puncon2">
<td style="white-space: nowrap"><?php print htmlspecialchars($poster) ?></td>
<td>&nbsp;</td>
<td>Guest</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<?php
}
}
}
else
print "\t".'<tr class="puncon2"><td colspan="8">The supplied IP address could not be found in the database.</td></tr>'."\n";
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
else if (isset($_POST['find_user']))
{
$form = $_POST['form'];
$form['username'] = $_POST['username'];
// trim() all elements in $form
$form = array_map('trim', $form);
$posts_greater = trim($_POST['posts_greater']);
$posts_less = trim($_POST['posts_less']);
$last_post_after = trim($_POST['last_post_after']);
$last_post_before = trim($_POST['last_post_before']);
$registered_after = trim($_POST['registered_after']);
$registered_before = trim($_POST['registered_before']);
$order_by = $_POST['order_by'];
$direction = $_POST['direction'];
$user_group = $_POST['user_group'];
if (preg_match('/[^0-9]/', $posts_greater.$posts_less))
message('You entered a non-numeric value into a numeric only column.');
// Try to convert date/time to timestamps
if ($last_post_after != '')
$last_post_after = strtotime($last_post_after);
if ($last_post_before != '')
$last_post_before = strtotime($last_post_before);
if ($registered_after != '')
$registered_after = strtotime($registered_after);
if ($registered_before != '')
$registered_before = strtotime($registered_before);
if ($last_post_after == -1 || $last_post_before == -1 || $registered_after == -1 || $registered_before == -1)
message('You entered an invalid date/time.');
if ($last_post_after != '')
$conditions[] = 'last_post>'.$last_post_after;
if ($last_post_before != '')
$conditions[] = 'last_post<'.$last_post_before;
if ($registered_after != '')
$conditions[] = 'registered>'.$registered_after;
if ($registered_before != '')
$conditions[] = 'registered<'.$registered_before;
foreach ($form as $key => $input)
{
if ($input != '')
$conditions[] = $key.' LIKE \''.un_escape(str_replace('*', '%', $input)).'\'';
}
if ($posts_greater != '')
$conditions[] = 'num_posts>'.$posts_greater;
if ($posts_less != '')
$conditions[] = 'num_posts<'.$posts_less;
if ($user_group != 'all')
$conditions[] = 'status='.$user_group;
if (!isset($conditions))
message('You didn\'t enter any search terms.');
$page_title = htmlspecialchars($options['board_title']).' / Admin / Users';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('users');
else
moderator_menu('users');
?>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 11%; white-space: nowrap">Username</td>
<td class="punhead" style="width: 21%; white-space: nowrap">E-mail</td>
<td class="punhead" style="width: 13%; white-space: nowrap">Title</td>
<td class="punhead" style="width: 10%; white-space: nowrap">Registered</td>
<td class="punhead" style="width: 10%; white-space: nowrap">Last post</td>
<td class="punhead" style="width: 5%; white-space: nowrap">Posts</td>
<td class="punhead" style="width: 14%">Admin note</td>
<td class="punhead" style="white-space: nowrap">Actions</td>
</tr>
<?php
$sql = 'SELECT id, username, email, title, num_posts, status, last_post, registered, admin_note FROM '.$db->prefix.'users WHERE id>1 AND '.implode(' AND ', $conditions).' ORDER BY '.$order_by.' '.$direction;
$result = $db->query($sql) or error('Unable to search for users', __FILE__, __LINE__, $db->error());
$num_users = $db->num_rows($result);
if ($num_users)
{
// Loop through users and print out some info
for ($i = 0; $i < $num_users; $i++)
{
$user_data = $db->fetch_assoc($result);
$user_title = get_title($user_data);
// This script is a special case in that we want to display "Not validated" for non-validated users
if ($user_data['status'] == -1 && $user_title != $lang_common['Banned'])
$user_title = '<span class="punhot">Not validated</span>';
$actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">View IP stats</a> - <a href="search.php?action=show_user&amp;user_id='.$user_data['id'].'">Show posts</a>';
?>
<tr class="puncon2">
<td style="white-space: nowrap"><?php print '<a href="profile.php?id='.$user_data['id'].'">'.htmlspecialchars($user_data['username']).'</a>' ?></td>
<td style="white-space: nowrap"><a href="mailto:<?php print $user_data['email'] ?>"><?php print $user_data['email'] ?></a></td>
<td style="white-space: nowrap"><?php print $user_title ?></td>
<td style="white-space: nowrap"><?php print format_time($user_data['registered'], true) ?></td>
<td style="white-space: nowrap"><?php print format_time($user_data['last_post'], true) ?></td>
<td style="white-space: nowrap"><?php print $user_data['num_posts'] ?></td>
<td><?php print ($user_data['admin_note'] != '') ? $user_data['admin_note'] : '&nbsp;' ?></td>
<td style="white-space: nowrap"><?php print $actions ?></td>
</tr>
<?php
}
}
else
print "\t".'<tr class="puncon2"><td colspan="8">No match.</td></tr>'."\n";
?>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
else
{
$page_title = htmlspecialchars($options['board_title']).' / Admin / Users';
$form_name = 'find_user';
$focus_element = 'username';
require 'header.php';
if ($cur_user['status'] > 1)
admin_menu('users');
else
moderator_menu('users');
?>
<form method="post" action="admin_users.php?action=find_user" id="find_user">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Users</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Find users&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellspacing="0" cellpadding="4">
<tr>
<td colspan="3">Search for users in the database. You can enter one or more terms to search for. Wildcards in the form of asterisks (*) are accepted.<br><br></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Username</td>
<td style="width: 35%"><input type="text" name="username" size="25" maxlength="25" tabindex="1"></td>
<td style="width: 30%" rowspan="16"><input type="submit" name="find_user" value=" Find " tabindex="21"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">E-mail address</td>
<td style="width: 35%"><input type="text" name="form[email]" size="30" maxlength="50" tabindex="2"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Title</td>
<td style="width: 35%"><input type="text" name="form[title]" size="30" maxlength="50" tabindex="3"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Real name</td>
<td style="width: 35%"><input type="text" name="form[realname]" size="30" maxlength="40" tabindex="4"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Website</td>
<td style="width: 35%"><input type="text" name="form[url]" size="35" maxlength="100" tabindex="5"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">ICQ</td>
<td style="width: 35%"><input type="text" name="form[icq]" size="12" maxlength="12" tabindex="6"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">AOL IM</td>
<td style="width: 35%"><input type="text" name="form[aim]" size="20" maxlength="20" tabindex="7"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Yahoo! Messenger</td>
<td style="width: 35%"><input type="text" name="form[yahoo]" size="20" maxlength="20" tabindex="8"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Location</td>
<td style="width: 35%"><input type="text" name="form[location]" size="30" maxlength="30" tabindex="9"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Signature</td>
<td style="width: 35%"><input type="text" name="form[signature]" size="35" maxlength="512" tabindex="10"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Admin note</td>
<td style="width: 35%"><input type="text" name="form[admin_note]" size="30" maxlength="30" tabindex="11"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Number of posts greater than</td>
<td style="width: 35%"><input type="text" name="posts_greater" size="5" maxlength="8" tabindex="12"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Number of posts less than</td>
<td style="width: 35%"><input type="text" name="posts_less" size="5" maxlength="8" tabindex="13"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Last post is after<br>(yyyy-mm-dd hh:mm:ss)</td>
<td style="width: 35%"><input type="text" name="last_post_after" size="24" maxlength="19" tabindex="14"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Last post is before<br>(yyyy-mm-dd hh:mm:ss)</td>
<td style="width: 35%"><input type="text" name="last_post_before" size="24" maxlength="19" tabindex="15"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Registered after<br>(yyyy-mm-dd hh:mm:ss)</td>
<td style="width: 35%"><input type="text" name="registered_after" size="24" maxlength="19" tabindex="16"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Registered before<br>(yyyy-mm-dd hh:mm:ss)</td>
<td style="width: 35%"><input type="text" name="registered_before" size="24" maxlength="19" tabindex="17"></td>
</tr>
<tr>
<td class="punright" style="width: 35%">Order by</td>
<td style="width: 35%">
<select name="order_by" tabindex="18">
<option value="username" selected>username</option>
<option value="email">e-mail</option>
<option value="num_posts">posts</option>
<option value="last_post">last post</option>
<option value="registered">registered</option>
</select>&nbsp;&nbsp;&nbsp;<select name="direction" tabindex="19">
<option value="ASC" selected>ascending</option>
<option value="DESC">descending</option>
</select>
</td>
</tr>
<tr>
<td class="punright" style="width: 35%">User group</td>
<td style="width: 35%">
<select name="user_group" tabindex="20">
<option value="all" selected>All groups</option>
<option value="0">Users</option>
<option value="1">Moderators</option>
<option value="2">Administrators</option>
<option value="-1">Not validated</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="get" action="admin_users.php">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">IP search</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Find users&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellspacing="0" cellpadding="4">
<tr>
<td class="punright" style="width: 35%"><b>IP address</b><br>The IP address to search for in the post database.</td>
<td style="width: 35%"><input type="text" name="show_users" size="18" maxlength="15" tabindex="22"></td>
<td style="width: 30%"><input type="submit" value=" Find " tabindex="23"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

176
delete.php Normal file
View File

@ -0,0 +1,176 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
if ($cookie['is_guest'])
message($lang_common['No permission']);
$id = intval($_GET['id']);
if (empty($id))
message($lang_common['Bad request']);
// Load the delete.php language file
require 'lang/'.$language.'/'.$language.'_delete.php';
// Fetch some info from the post we are deleting
$result = $db->query('SELECT poster, poster_id, message, smilies, topic_id FROM '.$db->prefix.'posts WHERE id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$cur_post = $db->fetch_assoc($result);
// Determine whether this post is the "topic post" or not
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$topicpost_id = $db->result($result, 0);
$is_topicpost = ($id == $topicpost_id) ? true : false;
// Fetch some info from the topic in which the post is located
$result = $db->query('SELECT subject, closed, forum_id FROM '.$db->prefix.'topics WHERE id='.$cur_post['topic_id']) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
list($subject, $topic_closed, $forum_id) = $db->fetch_row($result);
$forum_closed = '0';
$is_admmod = is_admmod($forum_id, $forum_closed, $admmod_only);
// If the current user isn't an administrator or a moderator of this forum
if (!$is_admmod)
{
if ($admmod_only == '1' && $cur_user['status'] < 1 ||
$topic_closed == '1' ||
$forum_closed == '1' ||
$permissions['users_del_post'] == '0' && $cur_user['status'] < 1 ||
$is_topicpost && $permissions['users_del_topic'] == '0' && $cur_user['status'] < 1 ||
$cur_post['poster_id'] != $cur_user['id'])
message($lang_common['No permission']);
}
if (isset($_POST['delete']))
{
if ($is_admmod)
confirm_referer('delete.php');
require 'include/searchidx.php';
// If it isn't the topic post
if (!$is_topicpost)
{
$result = $db->query('SELECT id, poster, posted FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted DESC LIMIT 2') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
list($last_id, ,) = $db->fetch_row($result);
list($second_last_id, $second_poster, $second_posted) = $db->fetch_row($result);
// Delete the post (start transaction)
$db->query('DELETE FROM '.$db->prefix.'posts WHERE id='.$id, PUN_TRANS_START) or error('Unable to delete post', __FILE__, __LINE__, $db->error());
strip_search_index($id);
// If the message we deleted is the most recent in the topic (at the end of the topic)
if ($last_id == $id)
{
// If there is a $second_last_id there is more than 1 reply to the topic
if ($second_last_id != NULL)
$db->query('UPDATE '.$db->prefix.'topics SET last_post='.$second_posted.', last_post_id='.$second_last_id.', last_poster=\''.addslashes($second_poster).'\', num_replies=num_replies-1 WHERE id='.$cur_post['topic_id']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
else
// We deleted the only reply, so now last_post/last_post_id/last_poster is posted/id/poster from the topic itself
$db->query('UPDATE '.$db->prefix.'topics SET last_post=posted, last_post_id=id, last_poster=poster, num_replies=num_replies-1 WHERE id='.$cur_post['topic_id']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
}
else
// Otherwise we just decrement the reply counter
$db->query('UPDATE '.$db->prefix.'topics SET num_replies=num_replies-1 WHERE id='.$cur_post['topic_id']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
update_forum($forum_id, PUN_TRANS_END); // end transaction
redirect('viewtopic.php?id='.$cur_post['topic_id'], $lang_delete['Post del redirect']);
}
else // It's the topic post
{
// Delete the topic and any redirect topics (start transaction)
$db->query('DELETE FROM '.$db->prefix.'topics WHERE id='.$cur_post['topic_id'].' OR moved_to='.$cur_post['topic_id'], PUN_TRANS_START) or error('Unable to delete topic', __FILE__, __LINE__, $db->error());
// Create a list of the post ID's in this topic and then strip the search index
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id']) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
$post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];
strip_search_index($post_ids);
// Delete posts in topic
$db->query('DELETE FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id']) or error('Unable to delete posts', __FILE__, __LINE__, $db->error());
update_forum($forum_id, PUN_TRANS_END); // end transaction
redirect('viewforum.php?id='.$forum_id, $lang_delete['Topic del redirect']);
}
}
else
{
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_delete['Delete post'];
require 'header.php';
require 'include/parser.php';
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['smilies']);
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="delete.php?id=<?php print $id ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_delete['Delete post'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Author'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<?php print htmlspecialchars($cur_post['poster']) ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Message'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">
<table class="punplain" cellspacing="0" cellpadding="4">
<tr><td><span class="puntext"><?php print $cur_post['message'] ?></span></td></tr>
</table>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">
<br>&nbsp;<?php print $lang_delete['Warning'] ?><br><br>
&nbsp;&nbsp;<input type="submit" name="delete" value="<?php print $lang_delete['Delete'] ?>">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)"><?php print $lang_common['Go back'] ?></a><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

340
docs/COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 2 of the License, or
(at your option) any later version.
This program 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

21
docs/example_config.php Normal file
View File

@ -0,0 +1,21 @@
<?php
// This is just an example config. The install script will generate a correct
// version of this file when you install PunBB. This file is here merely as a
// backup if the working version is somehow lost or corrupted.
$db_type = 'blabla';
$db_host = 'blabla';
$db_name = 'blabla';
$db_username = 'blabla';
$db_password = 'blabla';
$db_prefix = '';
$p_connect = true;
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
$language = 'en';
define('PUN', 1);

105
docs/install.html Normal file
View File

@ -0,0 +1,105 @@
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>PunBB 1.0 Installation</title>
</head>
<body>
<h1>PunBB 1.0 Installation</h1>
<p>NOTE: If you are upgrading from 1.0 RC 2, skip to section 3.</p>
<h2>1. Requirements</h2>
<ul>
<li>A webserver (preferably <a href=
"http://www.apache.org/">Apache</a>)</li>
<li><a href="http://www.php.net/">PHP</a> 4.2.0 or later</li>
<li><a href="http://www.mysql.com/">MySQL</a> or <a href=
"http://www.postgresql.org/">PostgreSQL</a> (see details
below)</li>
</ul>
<p>MySQL: Version 3.23 or later is recommended. PunBB will probably
work with older versions though.</p>
<p>PostgreSQL: PunBB 1.0 has only been tested on version 7.3.3 of
PostgreSQL. It should work fine with any version greater than 7.0
though. If the installer complains about not being able to create
an index, open up install.php and search for "PostgreSQL &lt;7.3
note".</p>
<h2>2. Installation</h2>
<p>Copy/upload all files and directories and run install.php from
the forum root directory. Follow the instructions. If you get an
error when trying to upload avatar images, make sure that PHP has
write access to the directory where you store avatars (default is
img/avatars). Please report any problems you might encounter during
installation in the forums at <a href=
"http://forums.punbb.org/">http://forums.punbb.org/</a>.</p>
<h2>3. Upgrading from 1.0 RC 2</h2>
<p>Follow these instructions to update your current 1.0 RC 2
installation to 1.0 final. It is recommended that the forum be put
into maintenance mode (Admin/Options) during the update
procedure.</p>
<p>NOTE: Make a backup before proceeding! Use the tool mysqldump
for MySQL and pg_dump for PostgreSQL. Also backup any CSS and
template files that you have made changes to.</p>
<ol>
<li>Update all scripts and files to 1.0. This is easily done by
extracting the 1.0 archive into the same directory as your old
installation (overwriting any existing files).</li>
<li>Copy the script 10_rc2_to_10_update.php from the directory
"extra" to the forum root directory and run it once. A message will
appear when the update process has completed. Once the update
script has finished you should remove the script from the forum
root directory.</li>
<li>Update any custom made css files so that the identifier names
no longer contain the character underscore. I.e. make "pun_head"
into "punhead".</li>
</ol>
<p>You should now be running PunBB 1.0.</p>
<h2>3. Maximizing performance</h2>
<p>Here are some recommendations for maximizing the performance of
PunBB. The recommendations are not directly related to PunBB
performance. They are very general and results may vary.</p>
<ul>
<li>Run it in a UNIX-like operating system!</li>
<li>Use the Apache webserver and compile PHP as a static module for
Apache.</li>
<li>Use a PHP caching tool (UNIX only). I recommend <a href=
"http://www.php-accelerator.co.uk/">PHP Accelerator</a> by Nick
Lindridge.</li>
<li>Make sure that PHP has zlib support so you can enable gzip
output compression in Admin/Options. This greatly reduces the size
of the HTML output at the cost of a little CPU time. An alternative
is to use the Apache module mod_gzip. The two methods yield similar
results.</li>
<li>Visit the administration interface and disable any forum
features that are not used or you feel are unnecessary.</li>
</ul>
<p>Thank you for using PunBB.<br>
<br>
Rickard Andersson<br>
<a href="mailto:punbb@telia.com">punbb@telia.com</a><br>
<a href="http://www.punbb.org/">http://www.punbb.org/</a><br>
</p>
</body>
</html>

218
edit.php Normal file
View File

@ -0,0 +1,218 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
if ($cookie['is_guest'])
message($lang_common['No permission']);
$id = intval($_GET['id']);
if (empty($id))
message($lang_common['Bad request']);
// Load the edit.php language file
require 'lang/'.$language.'/'.$language.'_edit.php';
// Fetch some info from the post we are editing
$result = $db->query('SELECT poster, poster_id, message, smilies, topic_id FROM '.$db->prefix.'posts WHERE id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$cur_post = $db->fetch_assoc($result);
// Determine whether this post is the "topic post" or not
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$topicpost_id = $db->result($result, 0);
$is_topicpost = ($id == $topicpost_id) ? true : false;
// Fetch some info from the topic in which the post is located
$result = $db->query('SELECT subject, closed, forum_id FROM '.$db->prefix.'topics WHERE id='.$cur_post['topic_id']) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
list($subject, $topic_closed, $forum_id) = $db->fetch_row($result);
$forum_closed = '0';
$is_admmod = is_admmod($forum_id, $forum_closed, $admmod_only);
// If the current user isn't an administrator or a moderator of this forum
if (!$is_admmod)
{
if ($admmod_only == '1' && $cur_user['status'] < 1 ||
$topic_closed == '1' ||
$forum_closed == '1' ||
$permissions['users_edit_post'] == '0' && $cur_user['status'] < 1 ||
$cur_post['poster_id'] != $cur_user['id'])
message($lang_common['No permission']);
}
if (isset($_POST['form_sent']))
{
if ($is_admmod)
confirm_referer('edit.php');
$smilies = $_POST['smilies'];
// If it is a topic it must contain a subject
if ($is_topicpost && $is_admmod)
{
$subject = trim(un_escape($_POST['req_subject']));
if ($subject == '')
message($lang_edit['No subject']);
else if (strlen($subject) > 70)
message($lang_edit['Too long subject']);
else if ($permissions['subject_all_caps'] == '0' && !preg_match('/[[:lower:]]/', $subject) && $cur_user['status'] < 1)
message($lang_edit['No caps subject']);
}
// Make sure all newlines are \n and not \r\n or \r
$message = str_replace("\r", "\n", str_replace("\r\n", "\n", trim(un_escape($_POST['req_message']))));
if ($message == '')
message($lang_edit['No message']);
else if (strlen($message) > 65535)
message($lang_edit['Too long message']);
else if ($permissions['message_all_caps'] === '0' && !preg_match("/[[:lower:]]/", $message) && $cur_user['status'] < 1)
message($lang_edit['No caps message']);
// Validate BBCode syntax
if ($permissions['message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
{
// Change all BBCodes to lower case (this way a lot of regex searches can be case sensitive)
$a = array('[B]', '[I]', '[U]', '[/B]', '[/I]', '[/U]');
$b = array('[b]', '[i]', '[u]', '[/b]', '[/i]', '[/u]');
$message = str_replace($a, $b, $message);
$a = array("#\[quote\]#i", "#\[/quote\]#i", "#\[code\]#i", "#\[/code\]#i", "#\[colou?r=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\]#i", "#\[/colou?r\]#i", "#\[img\]#i", "#\[/img\]#i", "#\[email\]#i", "#\[email=#i", "#\[/email\]#i", "#\[url\]#i", "#\[url=#i", "#\[/url\]#i");
$b = array('[quote]', '[/quote]', '[code]', '[/code]', "[color=\\1]", '[/color]', '[img]', '[/img]', '[email]', '[email=', '[/email]', '[url]', '[url=', '[/url]');
$message = preg_replace($a, $b, $message);
require 'include/parser.php';
if ($overflow = check_tag_order($message))
// The quote depth level was too high, so we strip out the inner most quote(s)
$message = substr($message, 0, $overflow[0]).substr($message, $overflow[1], (strlen($message) - $overflow[0]));
}
require 'include/searchidx.php';
if ($smilies != '1') $smilies = '0';
if (!isset($_POST['silent']) || !$is_admmod)
$edited_sql = ', edited='.time().', edited_by=\''.addslashes($cur_user['username']).'\'';
if ($is_topicpost && $is_admmod)
{
// Update the topic
$db->query('UPDATE '.$db->prefix.'topics SET subject=\''.addslashes($subject).'\' WHERE id='.$cur_post['topic_id']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
// Update any redirect topics as well
$db->query('UPDATE '.$db->prefix.'topics SET subject=\''.addslashes($subject).'\' WHERE moved_to='.$cur_post['topic_id']) or error('Unable to update redirect topic', __FILE__, __LINE__, $db->error());
// We changed the subject, so we need to take that into account when we update the search words
update_search_index('edit', $id, $message, $subject);
}
else
update_search_index('edit', $id, $message);
// Update the post
$db->query('UPDATE '.$db->prefix.'posts SET message=\''.addslashes($message).'\', smilies=\''.$smilies.'\''.isset($edited_sql).' WHERE id='.$id) or error('Unable to update post', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?pid='.$id.'#'.$id, $lang_edit['Edit redirect']);
}
else
{
if ($options['smilies'] == '1')
{
if ($cur_post['smilies'] == '1')
$checkboxes[] = '<input type="checkbox" name="smilies" value="1" checked>&nbsp;'.$lang_edit['Show smilies'];
else
$checkboxes[] = '<input type="checkbox" name="smilies" value="1">&nbsp;'.$lang_edit['Show smilies'];
}
if ($is_admmod)
$checkboxes[] = '<input type="checkbox" name="silent" value="1" checked>&nbsp;'.$lang_edit['Silent edit'];
if (isset($checkboxes))
$checkboxes = implode('<br>'."\n\t\t\t\t", $checkboxes);
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_edit['Edit message'];
$validate_form = true;
$form_name = 'edit';
$focus_element = 'req_message';
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="edit.php?id=<?php print $id ?>&amp;action=edit" id="edit" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_edit['Edit message'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_common['Author'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<?php print htmlspecialchars($cur_post['poster']) ?></td>
</tr>
<?php if ($is_topicpost && $is_admmod): ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_edit['Subject'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<input type="text" name="req_subject" size="80" maxlength="70" value="<?php print htmlspecialchars($subject) ?>"></td>
</tr>
<?php endif; ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">
<b><?php print $lang_common['Message'] ?></b>&nbsp;&nbsp;<br><br>
HTML: <?php print ($permissions['message_html'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">BBCode</a>: <?php print ($permissions['message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">[img] tag</a>: <?php print ($permissions['message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">Smilies</a>: <?php print ($options['smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;
</td>
<td class="puncon2">&nbsp;<textarea name="req_message" rows="20" cols="95"><?php print htmlspecialchars($cur_post['message']) ?></textarea></td>
</tr>
<?php if (isset($checkboxes)): ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Options'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">
<?php print $checkboxes."\n" ?>
</td>
</tr>
<?php endif; ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2"><br>&nbsp;&nbsp;<input type="submit" name="submit" value="<?php print $lang_common['Submit'] ?>" accesskey="s">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)"><?php print $lang_common['Go back'] ?></a><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

View File

@ -0,0 +1,129 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// This script updates the forum database from version 1.0 RC 1 to
// 1.0 RC 2. Copy this file to the forum root directory and run it. Then
// remove it from the root directory or anyone will be able to run it (NOT
// good!).
$update_from = '1.0 RC 2';
$update_to = '1.0';
@include 'config.php';
// If config.php doesn't exist, PUN won't be defined
if (!defined('PUN'))
exit('This file must be run from the forum root directory.');
// Turn off PHP time limit
@set_time_limit(0);
function error($message, $file, $line, $db_error = false)
{
print '<b>An error was encountered</b><br><br>'."\n".'<b>File:</b> '.$file.'<br>'."\n".'<b>Line:</b> '.$line.'<br><br>'."\n".'<b>PunBB reported</b>: '.$message."\n";
if ($db_error != false)
print '<br><b>Database reported:</b> '.htmlspecialchars($db_error['error']).' (Errno: '.$db_error['errno'].')'."\n";
exit;
}
// Update posts, topics, lastpost, lastpostid and lastposter for a forum (orphaned topics are not included)
function update_forum($forum_id)
{
global $db;
$result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE moved_to IS NULL AND forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error());
list($num_topics, $num_posts) = $db->fetch_row($result);
$num_posts = $num_posts + $num_topics; // $num_posts is only the sum of all replies (we have to add the topic posts)
$result = $db->query('SELECT last_post, last_post_id, last_poster FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1') or error('Unable to fetch last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result)) // There are topics in the forum
{
list($last_post, $last_post_id, $last_poster) = $db->fetch_row($result);
$db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.addslashes($last_poster).'\' WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
}
else // There are no topics
$db->query('UPDATE '.$db->prefix.'forums SET num_topics=0, num_posts=0, last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
}
// Load DB abstraction layer and try to connect
require 'include/dblayer/commondb.php';
// Check current version
$result = $db->query('SELECT cur_version FROM '.$db->prefix.'options');
if (!$result || $db->result($result, 0) != $update_from)
error('This script can only update version '.$update_from.'. The database "'.$db_name.'" doesn\'t seem to be running that version. Update process aborted.', __FILE__, __LINE__);
switch ($db_type)
{
case 'mysql':
$query = 'ALTER TABLE '.$db->prefix."posts MODIFY poster_id INT(10) UNSIGNED NOT NULL DEFAULT '1'";
break;
case 'pgsql':
$query = 'ALTER TABLE '.$db->prefix."posts ALTER poster_id SET DEFAULT '1'";
break;
}
$db->query($query) or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
// Move the guest account to ID 1
$result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'users');
$new_id = $db->result($result, 0) + 1; // Next available ID
$db->query('UPDATE '.$db->prefix.'users SET id='.$new_id.' WHERE id=1') or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
$db->query('UPDATE '.$db->prefix.'posts SET poster_id='.$new_id.' WHERE poster_id=1') or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
$db->query('UPDATE '.$db->prefix.'reports SET reported_by='.$new_id.' WHERE reported_by=1') or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
$db->query('UPDATE '.$db->prefix."users SET id=1 WHERE username='Guest'") or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
// This feels like a good time to update lastpost/lastposter for all forums
$result = $db->query('SELECT id FROM '.$db->prefix.'forums') or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
while ($row = $db->fetch_row($result))
update_forum($row[0]);
// We'll empty the search results table as well
$db->query('TRUNCATE TABLE '.$db->prefix.'search_results') or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
// Update version information in database
$db->query('UPDATE '.$db->prefix.'options SET cur_version=\''.$update_to.'\'') or exit('Error on line: '.__LINE__.'<br>'.$db_type.' reported: '.current($db->error()));
exit('Update successful! Your forum database has now been updated to version '.$update_to.'. You must now remove this script from the forum root directory!');

View File

@ -0,0 +1,43 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// This script deletes any users that have registered but never logged in.
// Copy this file to the forum root directory and run it. Then remove it
// from the root directory or anyone will be able to run it (NOT good!).
@include 'config.php';
if (!defined('PUN'))
exit('This file must be run from the forum root directory.');
require 'include/common.php';
print 'Pruning unvalidated users... ';
$result = $db->query('DELETE FROM '.$db->prefix.'users WHERE id>1 AND status=-1') or error('Unable to prune unvalidated users', __FILE__, __LINE__, $db->error());
print 'success<br><br>Now remove this file!';
exit;

View File

@ -0,0 +1,46 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// This script turns off the maintenance mode. Use it you happened to log
// out while the forum was in maintenance mode. Copy this file to the forum
// root directory and run it. Then remove it from the root directory or
// anyone will be able to run it (NOT good!).
@include 'config.php';
if (!defined('PUN'))
exit('This file must be run from the forum root directory.');
// Tell common.php that we are running this script (prevent it from showing us the maintenance message)
define('PUN_TURN_OFF_MAINT', 1);
require 'include/common.php';
print 'Turning off maintenance mode... ';
$db->query('UPDATE '.$db->prefix.'options SET maintenance=0') or error('Unable to turn off maintenance mode', __FILE__, __LINE__, $db->error());
print 'success<br><br>Now remove this file!';
exit;

170
footer.php Normal file
View File

@ -0,0 +1,170 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{pun_main}', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - {pun_main}
// START SUBST - {pun_footer}
ob_start();
?>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr>
<td class="puncon2">
<table class="punplain" cellspacing="0" cellpadding="0">
<tr>
<td class="puntop">
<?php
if (isset($footer_style) == 'index' || isset($footer_style) == 'search')
{
if (!$cookie['is_guest'])
{
if ($footer_style != 'search')
print "\t\t\t\t\t\t".'<a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a><br>'."\n";
print "\t\t\t\t\t\t".'<a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a><br>'."\n";
print "\t\t\t\t\t\t".'<a href="search.php?action=show_user&user_id='.$cur_user['id'].'">'.$lang_common['Show your posts'].'</a><br>'."\n";
print "\t\t\t\t\t\t".'<a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a><br>'."\n";
}
else
{
if ($permissions['guests_search'] == '1')
print "\t\t\t\t\t\t".'<a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a><br>'."\n";
else
print "\t\t\t\t\t\t".'&nbsp;'."\n";
}
}
else if (isset($footer_style) == 'forum' || isset($footer_style) == 'topic')
{
// Display the "Jump to" drop list
if ($options['quickjump'] == '1')
{
?>
<b><?php print $lang_common['Jump to'] ?></b><br>
<form method="get" action="viewforum.php">
<select name="id" onchange="window.location=('viewforum.php?id='+this.options[this.selectedIndex].value)">
<?php
if ($cur_user['status'] < 1)
$extra = ' WHERE c.admmod_only=\'0\' AND f.admmod_only=\'0\'';
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra.' ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
while ($cur_forum = $db->fetch_assoc($result))
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
if (!empty($cur_category))
print "\t\t\t\t\t\t\t\t".'</optgroup>'."\n";
print "\t\t\t\t\t\t\t\t".'<optgroup label="'.htmlspecialchars($cur_forum['cat_name']).'">'."\n";
$cur_category = $cur_forum['cid'];
}
if ($cur_forum['fid'] != $forum_id)
print "\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'">'.htmlspecialchars($cur_forum['forum_name']).'</option>'."\n";
else
print "\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'" selected>'.htmlspecialchars($cur_forum['forum_name']).'</option>'."\n";
}
?>
</optgroup>
</select>
<input type="submit" value="<?php print $lang_common['Go'] ?>">
</form>
<?php
}
if ($footer_style == 'topic' && $is_admmod)
{
print "\t\t\t\t\t\t".'<br><a href="moderate.php?fid='.$forum_id.'&amp;move='.$id.'">'.$lang_common['Move topic'].'</a><br>'."\n";
if ($closed == '1')
print "\t\t\t\t\t\t".'<a href="moderate.php?fid='.$forum_id.'&amp;open='.$id.'">'.$lang_common['Open topic'].'</a><br>'."\n";
else
print "\t\t\t\t\t\t".'<a href="moderate.php?fid='.$forum_id.'&amp;close='.$id.'">'.$lang_common['Close topic'].'</a><br>'."\n";
if ($sticky == '1')
print "\t\t\t\t\t\t".'<a href="moderate.php?fid='.$forum_id.'&amp;unstick='.$id.'">'.$lang_common['Unstick topic'].'</a><br>'."\n";
else
print "\t\t\t\t\t\t".'<a href="moderate.php?fid='.$forum_id.'&amp;stick='.$id.'">'.$lang_common['Stick topic'].'</a><br>'."\n";
print "\t\t\t\t\t\t".'<a href="moderate.php?fid='.$forum_id.'&amp;edit_subscribers='.$id.'">'.$lang_common['Edit subscribers'].'</a>'."\n";
}
else if ($options['quickjump'] == '0') // Only print out the nbsp if we didn't display the quickjump
print "\t\t\t\t\t\t".'&nbsp;'."\n";
}
else if (isset($footer_style) == 'show_new')
print "\t\t\t\t\t\t".'<a href="misc?action=markread">'.$lang_common['Mark all as read'].'</a><br>'."\n";
else
print "\t\t\t\t\t\t".'&nbsp;'."\n";
?>
</td>
<td class="puntopright">
Powered by <a target="_blank" href="http://www.punbb.org/">PunBB</a><br>
Modified and migrated by <a target="_blank" href="https://github.com/Axmaw98">Ahmed Kawa</a><br>
Version: <?php print $options['cur_version'] ?><br>
&copy; Copyright 2002, 2003 Rickard Andersson
<?php
// Display debug info (if enabled/defined)
if (defined('PUN_DEBUG'))
{
// Display PHP Accelerator info if enabled
if (isset($_PHPA) && $_PHPA['ENABLED'] == 1)
print "\t\t\t\t\t\t".'<br>Accelerated by <a href="http://www.php-accelerator.co.uk/">PHP Accelerator '.$_PHPA['VERSION'].'</a>'."\n";
// Calculate script generation time
$time_diff = sprintf('%.3f', get_microtime() - $pun_start);
print "\t\t\t\t\t\t".'<br>[ <span class="punclosed">Generated in '.$time_diff.' seconds, '.$db->get_num_queries().' queries executed</span> ]'."\n";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{pun_footer}', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - {pun_footer}
exit($tpl_main);
// Close the db connection (and free up any result data)
$db->close();

166
header.php Normal file
View File

@ -0,0 +1,166 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 G>eneral Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Workaround for "current" Apache 2 + PHP module which seems to not
// cope with private cache control setting (from phpBB2)
if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache/2') !== 0)
header('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
else
header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
// Load the main template
$fp = fopen('include/template/main.tpl', 'r');
$tpl_main = trim(fread($fp, filesize('include/template/main.tpl')));
fclose($fp);
// START SUBST - {pun_content_direction}
$tpl_main = str_replace('{pun_content_direction}', $lang_common['lang_direction'], $tpl_main);
// END SUBST - {pun_content_direction}
// START SUBST - {pun_char_encoding}
$tpl_main = str_replace('{pun_char_encoding}', $lang_common['lang_encoding'], $tpl_main);
// END SUBST - {pun_char_encoding}
// START SUBST - {pun_head}
ob_start();
if (isset($destination))
print '<meta http-equiv="refresh" content="'.$delay.';URL='.$destination.'">'."\n";
else
{
if ((isset($form_name) && isset($focus_element)) || isset($validate_form))
{
// Output javascript(s)
// With a quick and dirty hack to not disable submit buttons if user agent is Opera (since Opera
// refused to re-enable the button if we submit and then go back to this page)
?>
<script type="text/javascript">
<!--
<?php if ($validate_form): ?>function process_form(theform)
{
// Check for required elements
if (document.images) {
for (i = 0; i < theform.length; i++) {
if (theform.elements[i].name.substring(0, 4) == "req_") {
if ((theform.elements[i].type=="text" || theform.elements[i].type=="textarea" || theform.elements[i].type=="password" || theform.elements[i].type=="file") && theform.elements[i].value=='') {
alert(theform.elements[i].name.substring(4, 30) + " <?php print $lang_common['required field'] ?>")
return false
}
}
}
}
<?php if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Opera')): ?>
// Disable any submit buttons we find
if (document.all || document.getElementById) {
for (i = 0; i < theform.length; i++) {
var elem = theform.elements[i]
if (elem.type.toLowerCase() == "submit")
elem.disabled = true
}
return true
}
<?php endif; ?> return true
}
<?php endif; ?>// -->
</script>
<?php
}
}
$style = (isset($cur_user)) ? $cur_user['style'] : $options['default_style'];
?>
<title><?php print $page_title ?></title>
<link rel="stylesheet" type="text/css" href="style/<?php print $style.'.css' ?>">
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{pun_head}', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - {pun_head}
// START SUBST - {pun_body}
ob_start();
if (isset($form_name) && isset($focus_element))
print ' onLoad="document.getElementById(\''.$form_name.'\').'.$focus_element.'.focus()"';
$tpl_temp = ob_get_contents();
$tpl_main = str_replace('{pun_body}', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - {pun_body}
// START SUBST - {pun_title}
$tpl_main = str_replace('{pun_title}', htmlspecialchars($options['board_title']), $tpl_main);
// END SUBST - {pun_title}
// START SUBST - {pun_desc}
$tpl_main = str_replace('{pun_desc}', $options['board_desc'], $tpl_main);
// END SUBST - {pun_desc}
// START SUBST - {pun_navlinks}
$tpl_main = str_replace('{pun_navlinks}', generate_navlinks(), $tpl_main);
// END SUBST - {pun_navlinks}
// START SUBST - {pun_status}
if ($cookie['is_guest'])
$tpl_temp = $lang_common['Not logged in'];
else
$tpl_temp = $lang_common['Logged in as'].' <b>'.htmlspecialchars($cur_user['username']).'</b>.<br>'.$lang_common['Last visit'].': '.format_time($cookie['last_timeout']);
if (isset($cur_user['status']) > 0)
{
$result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());
if ($db->result($result_header, 0))
$tpl_temp .= '<br><a class="punhot" href="admin_reports.php">There are new reports</a>';
if ($options['maintenance'] == '1')
$tpl_temp .= '<br><a class="punhot" href="admin_options.php#maintenance"><b>Maintenance mode is enabled!</b></a>';
}
$tpl_main = str_replace('{pun_status}', $tpl_temp, $tpl_main);
// END SUBST - {pun_status}
// START SUBST - {pun_main}
ob_start();
define('PUN_HEADER', 1);

132
help.php Normal file
View File

@ -0,0 +1,132 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
if ($cookie['is_guest'] && $permissions['guests_read'] == '0')
message($lang_common['Login required'].' <a href="login.php">'.$lang_common['Login'].'</a> '.$lang_common['or'].' <a href="register.php">'.$lang_common['register'].'</a>.');
// Load the help.php language file
require 'lang/'.$language.'/'.$language.'_help.php';
// Determine what style to use (for the [img] example)
if ($cur_user['style'] != '' && @file_exists('style/'.$cur_user['style'].'.css'))
$img_url = $options['base_url'].'/img/'.$cur_user['style'].'_new.png';
else
$img_url = $options['base_url'].'/img/'.$options['default_style'].'_new.png';
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_help['Help'];
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_help['Help'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_help['BBCode'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px">
<?php print $lang_help['BBCode info 1'] ?><br><br>
<?php print $lang_help['BBCode info 2'] ?><br><br>
</div>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_help['Text style'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px">
<?php print $lang_help['Text style info'] ?><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;[b]<?php print $lang_help['Bold text'] ?>[/b] <?php print $lang_help['produces'] ?> <b><?php print $lang_help['Bold text'] ?></b><br>
&nbsp;&nbsp;&nbsp;&nbsp;[u]<?php print $lang_help['Underlined text'] ?>[/u] <?php print $lang_help['produces'] ?> <u><?php print $lang_help['Underlined text'] ?></u><br>
&nbsp;&nbsp;&nbsp;&nbsp;[i]<?php print $lang_help['Italic text'] ?>[/i] <?php print $lang_help['produces'] ?> <i><?php print $lang_help['Italic text'] ?></i><br>
&nbsp;&nbsp;&nbsp;&nbsp;[color=#FF0000]<?php print $lang_help['Red text'] ?>[/color] <?php print $lang_help['produces'] ?> <span style="color: #ff0000"><?php print $lang_help['Red text'] ?></span><br><br>
</div>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_help['Links and images'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px">
<?php print $lang_help['Links info'] ?><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;[url=<?php print $options['base_url'] ?>]<?php print htmlspecialchars($options['board_title']) ?>[/url] <?php print $lang_help['produces'] ?> <a href="<?php print $options['base_url'] ?>"><?php print htmlspecialchars($options['board_title']) ?></a><br>
&nbsp;&nbsp;&nbsp;&nbsp;[url]<?php print $options['base_url'] ?>[/url] <?php print $lang_help['produces'] ?> <a href="<?php print $options['base_url'] ?>"><?php print $options['base_url'] ?></a><br>
&nbsp;&nbsp;&nbsp;&nbsp;[email]myname@mydomain.com[/email] <?php print $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com">myname@mydomain.com</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;[email=myname@mydomain.com]<?php print $lang_help['My e-mail address'] ?>[/email] <?php print $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com"><?php print $lang_help['My e-mail address'] ?></a><br><br>
<?php print $lang_help['Images info'] ?><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;[img]<?php print $img_url ?>[/img] <?php print $lang_help['produces'] ?> <img src="<?php print $img_url ?>" border="0" align="top" alt=""><br><br>
</div>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_help['Quotes and code'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px">
<?php print $lang_help['Quotes info'] ?><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;[quote]<?php print $lang_help['Quote text'] ?>[/quote]<br><br>
<?php print $lang_help['produces quote box'] ?><br><br>
<table style="width: 95%" align="center" cellspacing="4" cellpadding="6"><tr><td class="punquote"><span class="puntext"><?php print $lang_help['Quote text'] ?></span></td></tr></table><br>
<?php print $lang_help['Code info'] ?><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;[code]<?php print $lang_help['Code text'] ?>[/code]<br><br>
<?php print $lang_help['produces code box'] ?><br><br>
<table style="width: 95%" align="center" cellspacing="4" cellpadding="6"><tr><td class="punquote"><span class="puntext"><b>code:</b></span><br><br><pre><?php print $lang_help['Code text'] ?></pre></td></tr></table><br>
</div>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_help['Nested tags'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px">
<?php print $lang_help['Nested tags info'] ?><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;[b][u]<?php print $lang_help['Bold, underlined text'] ?>[/u][/b] <?php print $lang_help['produces'] ?> <u><b><?php print $lang_help['Bold, underlined text'] ?></b></u><br><br>
</div>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_help['Smilies'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px">
<?php print $lang_help['Smilies info'] ?><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;:) <?php print $lang_common['and'] ?> =) <?php print $lang_help['produces'] ?> <img src="img/smilies/smile.png" width="15" height="15" alt=""><br>
&nbsp;&nbsp;&nbsp;&nbsp;:( <?php print $lang_common['and'] ?> =( <?php print $lang_help['produces'] ?> <img src="img/smilies/sad.png" width="15" height="15" alt=""><br>
&nbsp;&nbsp;&nbsp;&nbsp;:D <?php print $lang_common['and'] ?> =D <?php print $lang_help['produces'] ?> <img src="img/smilies/big_smile.png" width="15" height="15" alt=""><br>
&nbsp;&nbsp;&nbsp;&nbsp;;) <?php print $lang_help['produces'] ?> <img src="img/smilies/wink.png" width="15" height="15" alt=""><br>
&nbsp;&nbsp;&nbsp;&nbsp;:x <?php print $lang_help['produces'] ?> <img src="img/smilies/mad.png" width="15" height="15" alt=""><br>
&nbsp;&nbsp;&nbsp;&nbsp;:rolleyes: <?php print $lang_help['produces'] ?> <img src="img/smilies/roll.png" width="15" height="15" alt=""><br><br>
</div>
</td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

BIN
img/Cobalt_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
img/Lithium_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
img/Mercury_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
img/Oxygen_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
img/Radium_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
img/Sulfur_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

8
img/avatars/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

8
img/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

BIN
img/smilies/big_smile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

8
img/smilies/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

BIN
img/smilies/mad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

BIN
img/smilies/roll.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

BIN
img/smilies/sad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

BIN
img/smilies/smile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

BIN
img/smilies/wink.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

815
include/common.php Normal file
View File

@ -0,0 +1,815 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Enable debugging by removing // from the following line
define('PUN_DEBUG', 1);
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
// Record the start time (will be used to calculate the generation time for the page)
$pun_start = get_microtime();
// Make sure no one sends user information though GPC (only if register_globals is on)
unset($cur_user, $cookie);
// Disable error reporting for uninitialized variables
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Turn off magic_quotes_runtime
ini_set('magic_quotes_gpc', 'Off');
ini_set('magic_quotes_runtime', 'Off');
ini_set('magic_quotes_sybase', 'Off');
// Load the common language file
require 'lang/'.$language.'/'.$language.'_common.php';
// Load DB abstraction layer and try to connect
require 'include/dblayer/commondb.php';
// Get the forum options and permissions
$result = $db->query('SELECT * FROM '.$db->prefix.'options, '.$db->prefix.'permissions') or error('Unable to fetch forum options and permissions', __FILE__, __LINE__, $db->error());
$optperm = $db->fetch_assoc($result);
// The first 48 elements should be options and the rest permissions
list($options, $permissions) = array_chunk($optperm, 48, true);
// Enable output buffering
if (!defined('PUN_DISABLE_BUFFERING'))
{
// Should we use gzip output compression?
if ($options['gzip'] == '1' && extension_loaded('zlib') && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false || strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') !== false))
ob_start('ob_gzhandler');
else
ob_start();
}
// Check/update/set cookie and fetch user info
$cookie = check_cookie($cur_user);
// Check if we are to display a maintenance message
if ($options['maintenance'] == '1' && $cur_user['status'] < 2 && !defined('PUN_TURN_OFF_MAINT'))
maintenance_message();
// Check if current user is banned
check_bans();
// Update online list
update_users_online();
//
// Cookie stuff!
//
function check_cookie(&$cur_user)
{
global $db, $cookie_path, $cookie_domain, $cookie_secure, $options;
$now = time();
$expire = $now + 31536000; // The cookie expires after a year
if (isset($_COOKIE['punbb_cookie']))
{
$cookie = array();
$punbb_cookie = $_COOKIE['punbb_cookie'] ?? '';
if ($punbb_cookie) {
$cookie_values = unserialize(urldecode($punbb_cookie));
if (is_array($cookie_values)) {
$cookie['username'] = $cookie_values[0] ?? '';
$cookie['password'] = $cookie_values[1] ?? '';
$cookie['last_action'] = $cookie_values[2] ?? '';
$cookie['last_timeout'] = $cookie_values[3] ?? '';
}
}
if (strcasecmp($cookie['username'], 'Guest'))
{
$result = $db->query('SELECT * FROM '.$db->prefix.'users WHERE username=\''.addslashes($cookie['username']).'\'') or error('Unable to fetch user information', __FILE__, __LINE__, $db->error());
$cur_user = $db->fetch_assoc($result);
if (!is_null($cur_user) && isset($cur_user['disp_topics']) && $cur_user['disp_topics'] == '') {
$cur_user['disp_topics'] = $options['disp_topics_default'];
}
if (!isset($cur_user['disp_posts']) || $cur_user['disp_posts'] == '')
$cur_user['disp_posts'] = $options['disp_posts_default'];
// Determine what style to use
if (!@file_exists('style/'.$cur_user['style'].'.css'))
$cur_user['style'] = $options['default_style'];
// If the user couldn't be found or if the password was incorrect
if (!$cur_user || !isset($cookie['password']) || !isset($cur_user['password']) || md5($cookie['password']) !== md5($cur_user['password']))
{
setcookie('punbb_cookie', serialize(array('Guest', 'Guest', $now, $now)), $expire, $cookie_path, $cookie_domain, $cookie_secure);
$cookie['username'] = 'Guest';
$cookie['password'] = 'Guest';
$cookie['last_action'] = $now;
$cookie['last_timeout'] = $now;
$cookie['is_guest'] = true;
return $cookie;
}
if ($cur_user['save_pass'] == '0')
$expire = 0;
// Define this if you don't want PunBB to update the current users cookie
if (!defined('PUN_DONT_UPDATE_COOKIE'))
{
// Has the user been idle longer than timeout_cookie?
if ($now > ($cookie['last_action'] + $options['timeout_cookie']))
{
$cookie['last_timeout'] = $cookie['last_action'];
$cookie['last_action'] = $now;
setcookie('punbb_cookie', serialize(array($cookie['username'], $cookie['password'], $now, $cookie['last_timeout'])), $expire, $cookie_path, $cookie_domain, $cookie_secure);
}
else
{
$cookie['last_action'] = $now;
setcookie('punbb_cookie', serialize(array($cookie['username'], $cookie['password'], $now, $cookie['last_timeout'])), $expire, $cookie_path, $cookie_domain, $cookie_secure);
}
}
$cookie['is_guest'] = false;
}
else
$cookie['is_guest'] = true;
}
else
{
$cookie['username'] = 'Guest';
$cookie['password'] = 'Guest';
$cookie['last_action'] = $now;
$cookie['last_timeout'] = $now;
$cookie['is_guest'] = true;
}
return $cookie;
}
//
// Try to determine the correct remote IP-address
//
function get_remote_address()
{
// If HTTP_X_FORWARDED_FOR is set we grab the first address in the list
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses))
return $addresses[0];
}
// If no address was found in HTTP_X_FORWARDED_FOR, we try HTTP_CLIENT_IP and if that isn't set we return REMOTE_ADDR
return (isset($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : $_SERVER['REMOTE_ADDR'];
}
//
// Add slashes only if magic_quotes_gpc is off
//
function escape($str)
{
$magic_quotes_active = (bool) ini_get('magic_quotes_gpc');
if ($magic_quotes_active) {
$str = stripslashes($str);
}
return addslashes($str);
}
//
// Strip slashes only if magic_quotes_gpc is on
//
function un_escape($str)
{
return (ini_get('magic_quotes_gpc') == 1) ? stripslashes($str) : $str;
}
//
// Check whether the connecting user is banned (and delete any expired bans)
//
function check_bans()
{
global $db, $cookie, $options, $lang_common;
$ip = get_remote_address();
$result = $db->query('SELECT id, username, ip, expire FROM '.$db->prefix.'bans WHERE username IS NOT NULL OR ip IS NOT NULL OR expire IS NOT NULL') or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
{
if ($row[3] != '' && $row[3] <= time())
{
$db->query('DELETE FROM '.$db->prefix.'bans WHERE id='.$row[0]) or error('Unable to delete expired ban', __FILE__, __LINE__, $db->error());
continue;
}
if (($row[1] != '' && !strcasecmp($cookie['username'], $row[1])) || ($row[2] != '' && !strcmp(substr($ip, 0, strlen($row[2])), $row[2])))
message($lang_common['Banned message'].' <a href="mailto:'.$options['admin_email'].'">'.$options['admin_email'].'</a>.');
}
}
//
// Update "Users online"
//
function update_users_online()
{
global $db, $cookie, $cur_user, $options;
if (!$cookie['is_guest'])
{
$user_id = $cur_user['id'];
$ident = addslashes($cookie['username']);
}
else
{
$user_id = 0;
$ident = get_remote_address();
}
$now = time();
// Delete entries older than timeout_online seconds and any duplicates (start transaction)
$db->query('DELETE FROM '.$db->prefix.'online WHERE logged<'.($now-$options['timeout_online']).' OR ident=\''.addslashes($cookie['username']).'\' OR ident=\''.get_remote_address().'\'', PUN_TRANS_START) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
// Add a new entry. username and user_id if logged in; ip and user_id=0 if not (end transaction)
$db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(\''.$user_id.'\', \''.$ident.'\', '.$now.')', PUN_TRANS_END) or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
}
//
// Format a time string according to $time_format and timezones
//
function format_time($timestamp, $date_only = false)
{
global $cur_user, $options, $lang_common;
if ($timestamp == '')
return $lang_common['Never'];
if (!isset($cur_user) || !isset($cur_user['timezone']) || $options['server_timezone'] == $cur_user['timezone'])
$diff = 0;
else if ($options['server_timezone'] < $cur_user['timezone'])
{
if ($options['server_timezone'] >= 0 && $cur_user['timezone'] >= 0)
$diff = $cur_user['timezone'] - $options['server_timezone'];
else if ($options['server_timezone'] < 0 && $cur_user['timezone'] >= 0)
$diff = (-1*$options['server_timezone']) + $cur_user['timezone'];
else if ($options['server_timezone'] < 0 && $cur_user['timezone'] < 0)
$diff = $cur_user['timezone'] - $options['server_timezone'];
}
else
{
if ($options['server_timezone'] >= 0 && $cur_user['timezone'] >= 0)
$diff = $cur_user['timezone'] - $options['server_timezone'];
else if ($options['server_timezone'] >= 0 && $cur_user['timezone'] < 0)
$diff = (-1*$options['server_timezone']) + $cur_user['timezone'];
else if ($options['server_timezone'] < 0 && $cur_user['timezone'] < 0)
$diff = $cur_user['timezone'] - $options['server_timezone'];
}
$timestamp += $diff * 3600;
$now = time();
$date = date($options['date_format'], $timestamp);
$today = date($options['date_format'], $now);
$yesterday = date($options['date_format'], $now-86400);
if ($date == $today)
$date = $lang_common['Today'];
else if ($date == $yesterday)
$date = $lang_common['Yesterday'];
if (!$date_only)
return $date.' '.date($options['time_format'], $timestamp);
else
return $date;
}
//
// Generate the "navigator" that appears at the top of every page
//
function generate_navlinks()
{
global $cur_user, $options, $permissions, $cookie, $lang_common;
$links[] = '<a href="index.php">'.$lang_common['Home'].'</a> | <a href="userlist.php">'.$lang_common['User list'].'</a>';
if ($options['rules'] == '1')
$links[] = '<a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>';
if ($cookie['is_guest'])
{
if ($options['search'] == '1' && $permissions['guests_search'] == '1')
$links[] = '<a href="search.php">'.$lang_common['Search'].'</a>';
$links[] = '<a href="register.php">'.$lang_common['Register'].'</a> | <a href="login.php">'.$lang_common['Login'].'</a>';
$info = $lang_common['Not logged in'];
}
else
{
if ($cur_user['status'] < 1)
{
if ($options['search'] == '1')
$links[] = '<a href="search.php">'.$lang_common['Search'].'</a>';
$links[] = '<a href="profile.php?id='.$cur_user['id'].'">'.$lang_common['Profile'].'</a>';
$links[] = '<a href="login.php?action=out">'.$lang_common['Logout'].'</a>';
}
else
{
$links[] = '<a href="search.php">'.$lang_common['Search'].'</a>';
$links[] = '<a href="profile.php?id='.$cur_user['id'].'">'.$lang_common['Profile'].'</a>';
$links[] = '<a href="admin_index.php">'.$lang_common['Admin'].'</a>';
$links[] = '<a href="login.php?action=out">'.$lang_common['Logout'].'</a>';
}
}
return implode(' | ', $links);
}
//
// Update posts, topics, last_post, last_post_id and last_poster for a forum (redirect topics are not included)
// If $transaction == PUN_TRANS_END, this function will end the current transaction
//
function update_forum($forum_id, $transaction = 0)
{
global $db;
$result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE moved_to IS NULL AND forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error());
list($num_topics, $num_posts) = $db->fetch_row($result);
$num_posts = $num_posts + $num_topics; // $posts is only the sum of all replies (we have to add the topic posts)
$result = $db->query('SELECT last_post, last_post_id, last_poster FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1') or error('Unable to fetch last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result)) // There are topics in the forum
{
list($last_post, $last_post_id, $last_poster) = $db->fetch_row($result);
$db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.addslashes($last_poster).'\' WHERE id='.$forum_id, $transaction) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
}
else // There are no topics
$db->query('UPDATE '.$db->prefix.'forums SET num_topics=0, num_posts=0, last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id, $transaction) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
}
//
// Check whether the current user is an administrator or a moderator in $forum_id (also check if forum is closed and/or admmod_only)
//
function is_admmod($forum_id, &$forum_closed, &$admmod_only)
{
global $db, $cur_user;
$result = $db->query('SELECT moderators, admmod_only, closed FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
list($moderators, $admmod_only, $forum_closed) = $db->fetch_row($result);
$mods_array = ($moderators != '') ? unserialize($moderators) : array();
return (isset($cur_user['status']) == 2 || (isset($cur_user['status']) == 1 && array_key_exists($cur_user['username'], $mods_array))) ? true : false;
}
else
return false;
}
//
// Replace censored words in $text
//
function censor_words($text)
{
global $db;
static $search_for, $replace_with;
// If not already built, build an array of censor words and their replacement text
if (empty($search_for))
{
$result = $db->query('SELECT search_for, replace_with FROM '.$db->prefix.'censoring') or error('Unable to fetch censor word list', __FILE__, __LINE__, $db->error());
$num_words = $db->num_rows($result);
if ($num_words)
{
for ($i = 0; $i < $num_words; $i++)
{
list($search_for[$i], $replace_with[$i]) = $db->fetch_row($result);
$search_for[$i] = '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';
}
}
else
$search_for[] = 1; // Dummy entry
}
if (!empty($search_for) && $search_for[0] != 1)
$text = substr(preg_replace($search_for, $replace_with, ' '.$text.' '), 1, -1);
return $text;
}
//
// Determines the correct title for $user
// $user must contain the elements 'username', 'title', 'status' and 'posts'
//
function get_title($user)
{
global $db, $lang_common;
static $ban_list, $ranklist;
// If not already built, build an array of banned usernames
if (empty($ban_list))
{
$ban_list[] = 1; // Dummy entry
$result = $db->query('SELECT LOWER(username) FROM '.$db->prefix.'bans WHERE username IS NOT NULL') or error('Unable to fetch banned username list', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
$ban_list[] = $row[0];
}
// If not already built, build an array of ranks and their respective minimun number of posts
if (empty($ranklist))
{
$ranklist[] = 1; // Dummy entry
$result = $db->query('SELECT rank, min_posts FROM '.$db->prefix.'ranks ORDER BY min_posts') or error('Unable to fetch rank list', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
$ranklist[] = $row;
}
// If the user has a title
if ($user['title'] != '')
$user_title = htmlspecialchars($user['title']);
// If the user is banned
else if (in_array(strtolower($user['username']), $ban_list))
$user_title = $lang_common['Banned'];
else if ($user['status'] <= 0)
{
// Are there any ranks? (> 1 because there is a dummy entry)
if (count($ranklist) > 1)
{
@reset($ranklist);
next($ranklist);
foreach ($ranklist as $value)
{
if (intval($user['num_posts']) >= isset($value[1]))
$user_title = htmlspecialchars(isset($value[0]));
}
}
// If the user didn't "reach" any rank
if ($user_title == '')
$user_title = $lang_common['Member'];
}
else if ($user['status'] == 1)
$user_title = $lang_common['Moderator'];
else
$user_title = $lang_common['Administrator'];
return $user_title;
}
//
// Generate a string with numbered links (appears at the bottom of multipage scripts)
//
function paginate($num_pages, $p, $base_url)
{
global $lang_common;
if ($num_pages <= 1)
$string = '<u>1</u>';
else
{
if ($p > 4)
$string = '<a href="'.$base_url.'&amp;p=1">'.$lang_common['First page'].'</a>&nbsp;-';
// Don't ask me how the following works. It just does, OK? :-)
for ($current=$p-3, $stop=$p+4; $current < $stop; $current++)
{
if ($current < 1 || $current > $num_pages)
continue;
else if ($current != $p)
$string .= '&nbsp;<a href="'.$base_url.'&amp;p='.$current.'">'.$current.'</a>';
else
$string .= '&nbsp;<b>'.$current.'</b>';
}
if ($p < ($num_pages-3))
$string .= '&nbsp;-&nbsp;<a href="'.$base_url.'&amp;p='.$num_pages.'">'.$lang_common['Last page'].'</a>';
}
return $string;
}
//
// Make sure that HTTP_REFERER matches $options['base_url']/$script
//
function confirm_referer($script)
{
global $lang_common, $options;
if (!preg_match('#^'.preg_quote($options['base_url'].'/'.$script, '#').'#i', $_SERVER['HTTP_REFERER']))
message($lang_common['Bad referer']);
}
//
// Generate a random password of length $len
//
function random_pass($len)
{
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
while (strlen($password) < $len)
$password .= substr($chars, (mt_rand() % strlen($chars)), 1);
return $password;
}
//
// Display a message.
//
function message($message, $no_back_link = false)
{
global $db, $lang_common, $options, $pun_start;
if (!defined('PUN_HEADER'))
{
global $cur_user, $cookie;
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_common['Info'];
require 'header.php';
}
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead"><?php print $lang_common['Info'] ?></td>
</tr>
<tr>
<td class="puncon1">
<?php print $message ?><br><br>
<?php if (!$no_back_link): ?> <a href="JavaScript: history.go(-1)"><?php print $lang_common['Go back'] ?></a>.
<?php endif; ?> </td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
//
// Display a message when board is in maintenance mode.
//
function maintenance_message()
{
global $lang_common, $options, $cur_user;
$message = str_replace("\n", '<br>', $options['maintenance_message']);
$style = (!empty($cur_user)) ? $cur_user['style'] : $options['default_style'];
// Load the maintenance template
$fp = fopen('include/template/maintenance.tpl', 'r');
$tpl_maint = trim(fread($fp, filesize('include/template/maintenance.tpl')));
fclose($fp);
// START SUBST - {pun_content_direction}
$tpl_maint = str_replace('{pun_content_direction}', $lang_common['lang_direction'], $tpl_maint);
// END SUBST - {pun_content_direction}
// START SUBST - {pun_char_encoding}
$tpl_maint = str_replace('{pun_char_encoding}', $lang_common['lang_encoding'], $tpl_maint);
// END SUBST - {pun_char_encoding}
// START SUBST - {pun_head}
ob_start();
?>
<title><?php print htmlspecialchars($options['board_title']).' / '.$lang_common['Maintenance'] ?></title>
<link rel="stylesheet" type="text/css" href="style/<?php print $style.'.css' ?>">
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_maint = str_replace('{pun_head}', $tpl_temp, $tpl_maint);
ob_end_clean();
// END SUBST - {pun_head}
// START SUBST - {pun_maint_heading}
$tpl_maint = str_replace('{pun_maint_heading}', $lang_common['Maintenance'], $tpl_maint);
// END SUBST - {pun_maint_heading}
// START SUBST - {pun_maint_message}
$tpl_maint = str_replace('{pun_maint_message}', $message, $tpl_maint);
// END SUBST - {pun_maint_message}
exit($tpl_maint);
}
//
// Display $message and redirect user to $destination.
//
function redirect($destination, $message)
{
global $lang_common, $options, $cur_user;
if ($destination == '')
$destination = 'index.php';
$style = (!empty($cur_user)) ? $cur_user['style'] : $options['default_style'];
// Load the redirect template
$fp = fopen('include/template/redirect.tpl', 'r');
$tpl_redir = trim(fread($fp, filesize('include/template/redirect.tpl')));
fclose($fp);
// START SUBST - {pun_content_direction}
$tpl_redir = str_replace('{pun_content_direction}', $lang_common['lang_direction'], $tpl_redir);
// END SUBST - {pun_content_direction}
// START SUBST - {pun_char_encoding}
$tpl_redir = str_replace('{pun_char_encoding}', $lang_common['lang_encoding'], $tpl_redir);
// END SUBST - {pun_char_encoding}
// START SUBST - {pun_head}
ob_start();
?>
<meta http-equiv="refresh" content="<?php print $options['redirect_delay'] ?>;URL=<?php print $destination ?>">
<title><?php print htmlspecialchars($options['board_title']).' / '.$lang_common['Redirecting'] ?></title>
<link rel="stylesheet" type="text/css" href="style/<?php print $style.'.css' ?>">
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_redir = str_replace('{pun_head}', $tpl_temp, $tpl_redir);
ob_end_clean();
// END SUBST - {pun_head}
// START SUBST - {pun_redir_heading}
$tpl_redir = str_replace('{pun_redir_heading}', $lang_common['Redirecting'], $tpl_redir);
// END SUBST - {pun_redir_heading}
// START SUBST - {pun_redir_text}
$tpl_temp = $message.'<br><br>'.'<a href="'.$destination.'">'.$lang_common['Click redirect'].'</a>';
$tpl_redir = str_replace('{pun_redir_text}', $tpl_temp, $tpl_redir);
// END SUBST - {pun_redir_text}
exit($tpl_redir);
}
//
// Display a simple error message
//
function error($message, $file, $line, $db_error = false)
{
global $options, $db_type;
// Empty output buffer and stop buffering
ob_end_clean();
// "Restart" output buffering if we are using ob_gzhandler (since the gzip header is already sent)
if ($options['gzip'] == '1' && extension_loaded('zlib') && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false || strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') !== false))
ob_start('ob_gzhandler');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php print htmlspecialchars($options['board_title']) ?> / Error</title>
</head>
<body>
<table style="width: 60%; border: none; background-color: #666666" align="center" cellspacing="1" cellpadding="4">
<tr>
<td style="font: bold 10px Verdana, Arial, Helvetica, sans-serif; color: #593909; background-color: #EFAF50">An error was encountered</td>
</tr>
<tr>
<td style="font: 10px Verdana, Arial, Helvetica, sans-serif; background-color: #DEDFDF">
<?php
if (defined('PUN_DEBUG'))
{
print "\t\t\t".'<b>File:</b> '.$file.'<br>'."\n\t\t\t".'<b>Line:</b> '.$line.'<br><br>'."\n\t\t\t".'<b>PunBB reported</b>: '.$message."\n";
if ($db_error)
print "\t\t\t".'<br><b>Database reported:</b> '.htmlspecialchars($db_error['error']).' (Errno: '.$db_error['errno'].')'."\n";
}
else
print "\t\t\t".'Error: <b>'.$message.'.</b>'."\n";
?>
</td>
</tr>
</table>
</body>
</html>
<?php
// If a database connection was established (before this error) we close it
if ($db_error)
$GLOBALS[db]->close();
exit;
}
// DEBUG FUNCTIONS BELOW
//
// Return current timestamp (with microseconds) as a float
//
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
//
// Dump contents of variable(s)
//
function dump($var1, $var2 = null)
{
print '<pre>';
print_r($var1);
if ($var2 != null)
{
print "\n\n";
print_r($var2);
}
print '</pre>';
exit;
}

119
include/commonadmin.php Normal file
View File

@ -0,0 +1,119 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
//
// Displays link to admin pages (for moderators)
//
function admin_menu($page = NULL)
{
?>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td class="<?php print (!strcmp($page, 'categories')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_categories.php">Categories</a></b></td>
<td class="<?php print (!strcmp($page, 'forums')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_forums.php">Forums</a></b></td>
<td class="<?php print (!strcmp($page, 'users')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_users.php">Users</a></b></td>
<td class="<?php print (!strcmp($page, 'options')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_options.php">Options</a></b></td>
<td class="<?php print (!strcmp($page, 'permissions')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_permissions.php">Permissions</a></b></td>
<td class="<?php print (!strcmp($page, 'censoring')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_censoring.php">Censoring</a></b></td>
<td class="<?php print (!strcmp($page, 'ranks')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_ranks.php">Ranks</a></b></td>
<td class="<?php print (!strcmp($page, 'bans')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_bans.php">Bans</a></b></td>
<td class="<?php print (!strcmp($page, 'prune')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_prune.php">Prune</a></b></td>
<td class="<?php print (!strcmp($page, 'maintenance')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 10%; white-space: nowrap"><b><a href="admin_maintenance.php">Maintenance</a></b></td>
<td class="<?php print (!strcmp($page, 'reports')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 9%; white-space: nowrap"><b><a href="admin_reports.php">Reports</a></b></td>
</tr>
</table>
<?php
}
//
// Displays link to admin pages (for moderators)
//
function moderator_menu($page = NULL)
{
?>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td class="<?php print (!strcmp($page, 'users')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 25%; white-space: nowrap"><b><a href="admin_users.php">Users</a></b></td>
<td class="<?php print (!strcmp($page, 'censoring')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 25%; white-space: nowrap"><b><a href="admin_censoring.php">Censoring</a></b></td>
<td class="<?php print (!strcmp($page, 'bans')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 25%; white-space: nowrap"><b><a href="admin_bans.php">Bans</a></b></td>
<td class="<?php print (!strcmp($page, 'reports')) ? 'puncon1cent' : 'puncent'; ?>" style="width: 25%; white-space: nowrap"><b><a href="admin_reports.php">Reports</a></b></td>
</tr>
</table>
<?php
}
//
// Delete topics from $forum_id that are "older than" $prune_date (if $prune_sticky is 1, sticky topics will also be deleted)
//
function prune($forum_id, $prune_sticky, $prune_date)
{
global $db;
if ($prune_date != -1)
$extra = ' AND last_post<'.$prune_date;
if (!$prune_sticky)
$extra .= ' AND sticky=\'0\'';
// Fetch topics to prune
$result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.$extra) or error('Unable to fetch topics', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
$topic_ids .= (($topic_ids != '') ? ',' : '').$row[0];
if ($topic_ids != '')
{
// Fetch posts to prune
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topic_ids.')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
$post_ids .= (($post_ids != '') ? ',' : '').$row[0];
if ($post_ids != '')
{
// Delete topics (start transaction)
// End transaction must be done after prune() (i.e. in updateForum() or when deleting a forum)
$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')', PUN_TRANS_START) or error('Unable to prune topics', __FILE__, __LINE__, $db->error());
$db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error());
// We removed a bunch of posts, so now we have to update the search index
require 'include/searchidx.php';
strip_search_index($post_ids);
}
}
}

View File

@ -0,0 +1,48 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
define('PUN_TRANS_START', 1);
define('PUN_TRANS_END', 2);
// Load the appropriate DB layer class
switch ($db_type)
{
case 'mysql':
require 'include/dblayer/mysql.php';
break;
case 'pgsql':
require 'include/dblayer/pgsql.php';
break;
default:
error('\''.$db_type.'\' is not a valid database type. Please check settings in config.php', __FILE__, __LINE__);
break;
}
// Create the database object (and connect to/select db)
$db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect);

View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

201
include/dblayer/mysql.php Normal file
View File

@ -0,0 +1,201 @@
<?php
/***********************************************************************
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure we have built in support for MySQL
if (!function_exists('mysqli_connect')) {
exit('This PHP environment doesn\'t have Improved MySQL (mysqli) support built in. Improved MySQL support is required if you want to use a MySQL 4.1 (or later) database to run this forum. Consult the PHP documentation for further assistance.');
}
class DBLayer
{
var $prefix;
var $link_id;
var $query_result;
var $saved_queries = array();
var $num_queries = 0;
function __construct($db_host, $db_username, $db_password, $db_name, $db_prefix, $foo)
{
$this->prefix = $db_prefix;
// Was a custom port supplied with $db_host?
if (strpos($db_host, ':') !== false) {
list($db_host, $db_port) = explode(':', $db_host);
}
if (isset($db_port)) {
$this->link_id = mysqli_connect($db_host, $db_username, $db_password, $db_name, null, $db_port);
} else {
$this->link_id = mysqli_connect($db_host, $db_username, $db_password, $db_name);
}
if (!$this->link_id) {
error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__);
}
}
function start_transaction()
{
return;
}
function end_transaction()
{
return;
}
function query($sql, $unbuffered = false)
{
if (defined('PUN_SHOW_QUERIES'))
$q_start = microtime(true);
if (is_array($sql)) {
$sql = implode(' ', $sql);
}
try {
$this->query_result = mysqli_query($this->link_id, $sql, $unbuffered ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);
} catch (mysqli_sql_exception $exception) {
// handle the exception, such as logging it or displaying an error message
echo 'Error: ' . $exception->getMessage();
}
if (!$this->query_result) {
die('Unable to execute query: ' . mysqli_error($this->link_id)); // Updated
}
if ($this->query_result)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, sprintf('%.5f', microtime(true) - $q_start));
++$this->num_queries;
return $this->query_result;
}
else
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, 0);
return false;
}
}
function result($query_id = 0, $row = 0)
{
if ($query_id)
{
if ($row)
mysqli_data_seek($query_id, $row);
$cur_row = mysqli_fetch_row($query_id);
return $cur_row[0] ?? false;
}
else
return false;
}
function fetch_assoc($query_id = 0)
{
return ($query_id) ? mysqli_fetch_assoc($query_id) : false;
}
function fetch_row($query_id = 0)
{
return ($query_id) ? mysqli_fetch_row($query_id) : false;
}
function num_rows($query_id = 0)
{
return ($query_id) ? mysqli_num_rows($query_id) : false;
}
function affected_rows()
{
return ($this->link_id) ? @mysqli_affected_rows($this->link_id) : false;
}
function insert_id()
{
return ($this->link_id) ? @mysqli_insert_id($this->link_id) : false;
}
function get_num_queries()
{
return $this->num_queries;
}
function get_saved_queries()
{
return $this->saved_queries;
}
function free_result($query_id = false)
{
return ($query_id) ? @mysqli_free_result($query_id) : false;
}
function escape($str)
{
if ($str === null) {
return '';
}
return is_array($str) ? '' : mysqli_real_escape_string($this->link_id, $str);
}
function error2()
{
$result['error_sql'] = @current(@end($this->saved_queries));
$result['error_no'] = @mysqli_errno($this->link_id);
$result['error_msg'] = @mysqli_error($this->link_id);
return $result;
}
function close()
{
if ($this->link_id)
{
if (is_a($this->query_result, 'mysqli_result'))
mysqli_free_result($this->query_result);
return mysqli_close($this->link_id);
}
else
return false;
}
}

306
include/dblayer/pgsql.php Normal file
View File

@ -0,0 +1,306 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure we have built in support for MySQL
if (!function_exists('pg_connect'))
exit('This PHP environment doesn\'t have PostgreSQL support built in. PostgreSQL support is required if you want to use a PostgreSQL database to run this forum. Consult the PHP documentation for further assistance.');
class DBLayer
{
var $prefix;
var $link_id;
var $query_result;
var $row = array();
var $row_num = array();
var $in_transaction = 0;
var $num_queries = 0;
function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
{
$this->prefix = $db_prefix;
if ($db_host != '')
{
if (strpos($db_host, ':') !== false)
{
list($db_host, $dbport) = explode(':', $db_host);
$connect_str[] = 'host='.$db_host.' port='.$dbport;
}
else
{
if ($db_host != 'localhost')
$connect_str[] = 'host='.$db_host;
}
}
if ($db_name)
$connect_str[] = 'dbname='.$db_name;
if ($db_username != '')
$connect_str[] = 'user='.$db_username;
if ($db_password != '')
$connect_str[] = 'password='.$db_password;
if ($p_connect)
$this->link_id = @pg_pconnect(implode(' ', $connect_str));
else
$this->link_id = @pg_connect(implode(' ', $connect_str));
if (!$this->link_id)
error('Unable to connect to PostgreSQL server and select database', __LINE__, __FILE__);
else
return $this->link_id;
}
function query($sql, $transaction = 0)
{
unset($this->query_result);
if ($sql != '')
{
$this->num_queries++;
$sql = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $sql);
if ($transaction == PUN_TRANS_START && !$this->in_transaction)
{
$this->in_transaction = true;
if (!@pg_query($this->link_id, 'BEGIN'))
return false;
}
$this->query_result = @pg_query($this->link_id, $sql);
if ($this->query_result)
{
if ($transaction == PUN_TRANS_END)
{
$this->in_transaction = false;
if (!@pg_query($this->link_id, 'COMMIT'))
{
@pg_query($this->link_id, 'ROLLBACK');
return false;
}
}
$this->last_query_text[$this->query_result] = $sql;
$this->row_num[$this->query_result] = 0;
unset($this->row[$this->query_result]);
return $this->query_result;
}
else
{
if ($this->in_transaction)
@pg_query($this->link_id, 'ROLLBACK');
$this->in_transaction = false;
return false;
}
}
else
{
if ($transaction == PUN_TRANS_END && $this->in_transaction)
{
$this->in_transaction = false;
if (!@pg_query($this->link_id, 'COMMIT'))
{
@pg_query($this->link_id, 'ROLLBACK');
return false;
}
}
return true;
}
}
function result($query_id = 0, $row = 0)
{
if (!$query_id)
$query_id = $this->query_result;
if ($query_id)
return @pg_fetch_result($query_id, $row, 0);
else
return false;
}
function fetch_array($query_id = 0)
{
if (!$query_id)
$query_id = $this->query_result;
if ($query_id)
{
$this->row = @pg_fetch_array($query_id, $this->row_num[$query_id]);
if ($this->row)
{
$this->row_num[$query_id]++;
return $this->row;
}
}
else
return false;
}
function fetch_assoc($query_id = 0)
{
if (!$query_id)
$query_id = $this->query_result;
if ($query_id)
{
$this->row = @pg_fetch_array($query_id, $this->row_num[$query_id], PGSQL_ASSOC);
if ($this->row)
{
$this->row_num[$query_id]++;
return $this->row;
}
}
else
return false;
}
function fetch_row($query_id = 0)
{
if (!$query_id)
$query_id = $this->query_result;
if ($query_id)
{
$this->row = @pg_fetch_row($query_id, $this->row_num[$query_id]);
if ($this->row)
{
$this->row_num[$query_id]++;
return $this->row;
}
}
else
return false;
}
function num_rows($query_id = 0)
{
if (!$query_id)
{
$query_id = $this->query_result;
}
return ($query_id) ? @pg_num_rows($query_id) : false;
}
function affected_rows($query_id = 0)
{
if (!$query_id)
$query_id = $this->query_result;
return ($query_id) ? @pg_affected_rows($query_id) : false;
}
function insert_id()
{
$query_id = $this->query_result;
if ($query_id && $this->last_query_text[$query_id] != '')
{
if (preg_match('/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is', $this->last_query_text[$query_id], $tablename))
{
$sql = 'SELECT currval(\''.$tablename[1].'_id_seq\') AS lastval';
$temp_q_id = @pg_query($this->link_id, $sql);
if (!$temp_q_id)
return false;
$temp_result = @pg_fetch_array($temp_q_id, 0, PGSQL_ASSOC);
return ($temp_result) ? $temp_result['lastval'] : false;
}
}
return false;
}
function get_num_queries()
{
return $this->num_queries;
}
function free_result($query_id = false)
{
if (!$query_id)
$query_id = $this->query_result;
return ($query_id) ? @pg_freeresult($query_id) : false;
}
function error($query_id = 0)
{
if (!$query_id)
$query_id = $this->query_result;
$result['error'] = trim(@pg_last_error($this->link_id));
$result['errno'] = -1;
return $result;
}
function close()
{
if ($this->link_id)
{
if ($this->in_transaction)
@pg_query($this->link_id, 'COMMIT');
if ($this->query_result)
@pg_freeresult($this->query_result);
return @pg_close($this->link_id);
}
else
return false;
}
}

157
include/email.php Normal file
View File

@ -0,0 +1,157 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
//
// Validate an e-mail address
//
function is_valid_email($email)
{
return preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $email);
}
//
// Check if $email is banned
//
function is_banned_email($email)
{
global $db, $options;
$result = $db->query('SELECT email FROM '.$db->prefix.'bans WHERE email IS NOT NULL') or error('Unable to fetch e-mail from ban list', __FILE__, __LINE__, $db->error());
$num_bans = $db->num_rows($result);
for ($i = 0; $i < $num_bans; $i++)
{
$cur_ban = $db->result($result, $i);
if (!strcmp($email, $cur_ban) || strpos($cur_ban, '@') === false && stristr($email, "@$cur_ban"))
return true;
}
return false;
}
//
// Wrapper for PHP's mail()
//
/*ini_set('SMTP', 'localhost');
ini_set('smtp_port', '80');
*/
function pun_mail($to, $subject, $message, $headers = '')
{
global $options;
if ($options['smtp_host'] != '')
smtp_mail($to, $subject, $message, $headers);
else
mail($to, $subject, $message, $headers);
}
//
// This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com).
// They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards.
//
function server_parse($socket, $response)
{
while (substr($server_response, 3, 1) != ' ')
{
if (!($server_response = fgets($socket, 256)))
error('Couldn\'t get mail server response codes. Please contact the forum administrator.', __FILE__, __LINE__);
}
if (!(substr($server_response, 0, 3) == $response))
error('Unable to send e-mail. Please contact the forum administrator with the following error message: "'.$server_response.'"', __FILE__, __LINE__);
}
//
// This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com).
// They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards.
//
function smtp_mail($to, $subject, $message, $headers = '')
{
global $options;
$recipients = explode(',', $to);
if (!($socket = fsockopen($options['smtp_host'], 25, $errno, $errstr, 15)))
error('Could not connect to smtp host "'.$options['smtp_host'].'" ('.$errno.') ('.$errstr.')', __FILE__, __LINE__);
server_parse($socket, '220');
if ($options['smtp_user'] != '' && $options['smtp_pass'] != '')
{
fwrite($socket, 'EHLO ' . $options['smtp_host']."\r\n");
server_parse($socket, '250');
fwrite($socket, 'AUTH LOGIN'."\r\n");
server_parse($socket, '334');
fwrite($socket, base64_encode($options['smtp_user'])."\r\n");
server_parse($socket, '334');
fwrite($socket, base64_encode($options['smtp_pass'])."\r\n");
server_parse($socket, '235');
}
else
{
fwrite($socket, 'HELO '.$options['smtp_host']."\r\n");
server_parse($socket, '250');
}
fwrite($socket, 'MAIL FROM: <'.$options['webmaster_email'].'>'."\r\n");
server_parse($socket, '250');
$to_header = 'To: ';
@reset($recipients);
while (list(, $email) = @each($recipients))
{
fwrite($socket, 'RCPT TO: <'.$email.'>'."\r\n");
server_parse($socket, '250');
$to_header .= '<'.$email.'>, ';
}
fwrite($socket, 'DATA'."\r\n");
server_parse($socket, '354');
fwrite($socket, 'Subject: '.$subject."\r\n".$to_header."\r\n".$headers."\r\n\r\n".$message."\r\n");
fwrite($socket, '.'."\r\n");
server_parse($socket, '250');
fwrite($socket, 'QUIT'."\r\n");
fclose($socket);
return true;
}

8
include/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

385
include/parser.php Normal file
View File

@ -0,0 +1,385 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
//
// Split the message into tokens ($inside contains all text inside $start and $end, and $outside contains all text outside)
//
function split_text($text, $start, $end)
{
global $options;
$tokens = explode($start, $text);
$outside[] = $tokens[0];
$num_tokens = count($tokens);
for ($i = 1; $i < $num_tokens; $i++)
{
$temp = explode($end, $tokens[$i]);
$inside[] = $temp[0];
$outside[] = $temp[1];
}
if ($options['indent_num_spaces'] != 8 && $start == '[code]')
{
$spaces = str_repeat(' ', $options['indent_num_spaces']);
$inside = str_replace("\t", $spaces, $inside);
}
return array($inside, $outside);
}
//
// Parse text and make sure that [code] and [quote] syntax is correct
//
function check_tag_order($text)
{
global $lang_common;
// The maximum allowed quote depth
$max_depth = 3;
$q_depth = 0;
while (true)
{
$c_start = strpos($text, '[code]');
$c_end = strpos($text, '[/code]');
$q_start = strpos($text, '[quote]');
$q_end = strpos($text, '[/quote]');
// Deal with strpos() returning false when the string is not found
if ($c_start === false) $c_start = 65536;
if ($c_end === false) $c_end = 65536;
if ($q_start === false) $q_start = 65536;
if ($q_end === false) $q_end = 65536;
// If none of the strings were found
if (min($c_start, $c_end, $q_start, $q_end) == 65536)
break;
// We found a [quote]
if ($q_start < min($q_end, $c_start, $c_end))
{
$cur_index = 0;
$cur_index += $q_start+7;
// Did we reach $max_depth?
if ($q_depth == $max_depth)
$overflow_begin = ($cur_index-7);
$q_depth++;
$text = substr($text, $q_start+7);
}
// We found a [/quote]
else if ($q_end < min($q_start, $c_start, $c_end))
{
if ($q_depth == 0)
message($lang_common['BBCode error'].' '.$lang_common['BBCode error 1']);
$q_depth--;
$cur_index += $q_end+8;
// Did we reach $max_depth?
if ($q_depth == $max_depth)
$overflow_end = $cur_index;
$text = substr($text, $q_end+8);
}
// We found a [code]
else if ($c_start < min($c_end, $q_start, $q_end))
{
$tmp = strpos($text, '[/code]');
if ($tmp === false)
message($lang_common['BBCode error'].' '.$lang_common['BBCode error 2']);
else
$text = substr($text, $tmp+7);
$cur_index += $tmp+7;
}
// We found a [/code] (this shouldn't happen since we handle both start and end tag in the if clause above)
else if ($c_end < min($c_start, $q_start, $q_end))
message($lang_common['BBCode error'].' '.$lang_common['BBCode error 3']);
}
// If $q_depth <> 0 something is wrong with the quote syntax
if ($q_depth > 0)
message($lang_common['BBCode error'].' '.$lang_common['BBCode error 4']);
else if ($q_depth < 0)
message($lang_common['BBCode error'].' '.$lang_common['BBCode error 5']);
// If the quote depth level was higher than $max_depth we return the index for the
// beginning and end of the part we should strip out
if (isset($overflow_begin))
return array($overflow_begin, $overflow_end);
else
return null;
}
//
// Truncate URL if longer than 55 characters (add http:// or ftp:// if missing)
//
function truncate_url($url, $link = '')
{
global $cur_user;
$full_url = $url;
if (strpos($url, 'www.') === 0)
$full_url = 'http://'.$full_url;
else if (strpos($url, 'ftp.') === 0)
$full_url = 'ftp://'.$full_url;
// Ok, not very pretty :-)
$link = ($link == '' || $link == $url) ? ((strlen($url) > 55) ? substr($url, 0 , 39).' ... '.substr($url, -10) : $url) : stripslashes($link);
if ($cur_user['link_to_new_win'] == '0')
return '<a href="'.$full_url.'">'.$link.'</a>';
else
return '<a href="'.$full_url.'" target="_blank">'.$link.'</a>';
}
//
// Convert BBCodes to their HTML equivalent
//
function do_bbcode($message)
{
global $cur_user;
if (strpos($message, '[') !== false && strpos($message, ']') !== false)
{
$pattern = array("#\[b\](.*?)\[/b\]#s",
"#\[i\](.*?)\[/i\]#s",
"#\[u\](.*?)\[/u\]#s",
"#\[url\](.*?)\[/url\]#ie",
"#\[url=(.*?)\](.*?)\[/url\]#ie",
"#\[email\](.*?)\[/email\]#i",
"#\[email=(.*?)\](.*?)\[/email\]#i",
"#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s");
$replace = array('<b>$1</b>',
'<i>$1</i>',
'<u>$1</u>',
'truncate_url("$1")',
'truncate_url("$1", "$2")',
'<a href="mailto:$1">$1</a>',
'<a href="mailto:$1">$2</a>',
'<span style="color: $1">$2</span>');
// Run this big regex replacement
/*$message = preg_replace($pattern, $replace, $message);*/
if (strpos($message, 'quote]') !== false)
{
$message = str_replace('[quote]', '<br></span><table style="width: 95%" align="center" cellspacing="4" cellpadding="6"><tr><td class="punquote"><span class="puntext">', $message);
$message = str_replace('[/quote]', '</span></td></tr></table><span class="puntext"><br>', $message);
}
}
return $message;
}
//
// Make hyperlinks clickable
//
function do_clickable($message)
{
global $cur_user;
$message = ' '.$message;
$message = preg_replace_callback(
'#([\t\n ])([a-z0-9]+?){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i',
function($matches) {
return $matches[1] . truncate_url($matches[2] . '://' . $matches[3]);
},
$message
);
$message = preg_replace_callback(
'#([\t\n ])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i',
function($matches) {
return $matches[1] . truncate_url($matches[2] . '.' . $matches[3], $matches[2] . '.' . $matches[3]);
},
$message
);
return substr($message, 1);
}
//
// Convert a series of smilies to images
//
function do_smilies($message)
{
// Here you can add additional smilies if you like (please note that you must escape singlequote and backslash)
$text = array(':)', '=)', ':(', '=(', ':D', '=D', ';)', ':x', ':rolleyes:');
$img = array('smile.png', 'smile.png', 'sad.png', 'sad.png', 'big_smile.png', 'big_smile.png', 'wink.png', 'mad.png', 'roll.png');
// Uncomment the next row if you add smilies that contain any of the characters &"'<>
// $text = array_map('htmlspecialchars', $text);
$message = ' '.$message.' ';
$num_smilies = count($text);
for ($i = 0; $i < $num_smilies; $i++)
$message = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$img[$i].'" width="15" height="15" alt="'.$text[$i].'">$2', $message);
return substr($message, 1, -1);
}
//
// Parse message text
//
function parse_message($message, $smilies)
{
global $cur_user, $permissions, $options;
// Deal with some possible "exploits"
$message = preg_replace("#javascript:#i", '_javascript_:', $message);
$message = preg_replace("#about:#i", '_about_:', $message);
if ($options['censoring'] == '1')
$message = censor_words($message);
if ($permissions['message_html'] == '0')
$message = htmlspecialchars($message);
// If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched)
if (strpos($message, '[code]') !== false && strpos($message, '[/code]') !== false)
{
list($inside, $outside) = split_text($message, '[code]', '[/code]');
$outside = array_map('trim', $outside);
$message = implode('<">', $outside);
}
if ($options['make_links'] == '1')
$message = do_clickable($message);
if ($smilies == '1' && $options['smilies'] == '1' && isset($cur_user['show_img']) != '0')
$message = do_smilies($message);
if ($permissions['message_bbcode'] == '1')
{
$message = do_bbcode($message);
if ($permissions['message_img_tag'] == '1')
{
if (isset($cur_user['show_img']) != '0')
$message = preg_replace('#\[img\](.*?)\[/img\]#s', '<img src="$1" border="0" align="top" alt="">', $message);
else
{
if (isset($cur_user['link_to_new_win']) == '0')
$message = preg_replace('#\[img\](.*?)\[/img\]#s', '<a href="$1">&lt;image&gt;</a>', $message);
else
$message = preg_replace('#\[img\](.*?)\[/img\]#s', '<a href="$1" target="_blank">&lt;image&gt;</a>', $message);
}
}
}
// Deal with newlines, tabs and multiple spaces
$pattern = array("\n", "\t", ' ', ' ');
$replace = array('<br>', '&nbsp; &nbsp; ', '&nbsp; ', ' &nbsp;');
$message = str_replace($pattern, $replace, $message);
// If we split up the message before we have to concatenate it together again (code tags)
if (isset($inside))
{
$outside = explode('<">', $message);
$message = '';
$num_tokens = count($outside);
for ($i = 0; $i < $num_tokens; $i++)
{
$message .= $outside[$i];
if ($inside[$i])
$message .= '<br><br></span><table style="width: 95%" align="center" cellspacing="4" cellpadding="6"><tr><td class="punquote"><span class="puntext"><b>code:</b></span><br><br><pre>'.trim($inside[$i]).'</pre></td></tr></table><span class="puntext"><br>';
}
}
return $message;
}
//
// Parse signature text
//
function parse_signature($message)
{
global $cur_user, $permissions, $options;
// Deal with some possible "exploits"
$message = preg_replace('/javascript:/i', '_javascript_:', $message);
$message = preg_replace('/about:/i', '_about_:', $message);
if ($options['censoring'] == '1')
$message = censor_words($message);
if ($permissions['sig_html'] == '0')
$message = htmlspecialchars($message);
if ($options['make_links'] == '1')
$message = do_clickable($message);
if ($options['smilies_sig'] == '1' && $cur_user['show_img'] != '0')
$message = do_smilies($message);
if ($permissions['sig_bbcode'] == '1')
{
$message = do_bbcode($message);
if ($permissions['sig_img_tag'] == '1')
{
if ($cur_user['show_img'] != '0')
$message = preg_replace('#\[img\](.*?)\[/img\]#s', '<img src="$1" border="0" align="top" alt="">', $message);
else
{
if ($cur_user['link_to_new_win'] == '0')
$message = preg_replace('#\[img\](.*?)\[/img\]#s', '<a href="$1">&lt;image&gt;</a>', $message);
else
$message = preg_replace('#\[img\](.*?)\[/img\]#s', '<a href="$1" target="_blank">&lt;image&gt;</a>', $message);
}
}
}
// Deal with newlines, tabs and multiple spaces
$pattern = array("\n", "\t", ' ', ' ');
$replace = array('<br>', '&nbsp; &nbsp; ', '&nbsp; ', ' &nbsp;');
$message = str_replace($pattern, $replace, $message);
return $message;
}

225
include/searchidx.php Normal file
View File

@ -0,0 +1,225 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// The contents of this file are very much inspired by the file functions_search.php
// from the phpBB Group forum software phpBB2 (http://www.phpbb.com).
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
//
// "Cleans up" a text string and returns an array of unique words
// This function depends on the current locale setting
//
function split_words($text)
{
global $language;
static $noise_match, $noise_replace, $stopwords;
if (empty($noise_match))
{
$noise_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', ';', '!', '*');
$noise_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '' , ' ', ' ', ' ', ' ', ' ', ' ');
$stopwords = @file('lang/'.$language.'/'.$language.'_stopwords.txt');
}
// Clean up
$patterns[] = "#[\n\r]+#";
$patterns[] = '#&[\#a-z0-9]+?;#i';
$patterns[] = '#\b[\w]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?#';
$patterns[] = '#\[img:[a-z0-9]{10,}\].*?\[\/img:[a-z0-9]{10,}\]#';
$patterns[] = '#\[\/?url(=.*?)?\]#';
$patterns[] = '#\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]#';
$text = preg_replace($patterns, ' ', ' '.strtolower($text).' ');
// Filter out non-alphabetical chars
$text = str_replace($noise_match, $noise_replace, $text);
// Strip out too long and too short words
$text = preg_replace('#\b([\w]{1,2}|[\w]{21,})\b#is', ' ', $text);
if (!empty($stopwords))
{
@reset($stopwords);
foreach ($stopwords as $word)
$text = preg_replace('#\b'.preg_quote(trim($word)).'\b#', ' ', $text);
}
preg_match_all('#\b([\w]+)\b#', $text, $components);
return array_unique($components[1]);
}
//
// Updates the search index with the contents of $post_id (and $subject)
//
function update_search_index($mode, $post_id, $message, $subject = null)
{
global $db_type, $db;
// Split old and new post/subject to obtain array of 'words'
$words_message = split_words($message);
$words_subject = ($subject) ? split_words($subject) : array();
if ($mode == 'edit')
{
$result = $db->query('SELECT w.id, w.word, m.subject_match FROM '.$db->prefix.'search_words AS w INNER JOIN '.$db->prefix.'search_matches AS m ON w.id=m.word_id WHERE m.post_id='.$post_id) or error('Unable to fetch search index words', __FILE__, __LINE__, $db->error());
// Declare here to stop array_keys() and array_diff() from complaining if not set
$cur_words['post'] = array();
$cur_words['subject'] = array();
while ($row = $db->fetch_row($result))
{
$match_in = ($row[2]) ? 'subject' : 'post';
$cur_words[$match_in][$row[1]] = $row[0];
}
$db->free_result($result);
$words['add']['post'] = array_diff($words_message, array_keys($cur_words['post']));
$words['add']['subject'] = array_diff($words_subject, array_keys($cur_words['subject']));
$words['del']['post'] = array_diff(array_keys($cur_words['post']), $words_message);
$words['del']['subject'] = array_diff(array_keys($cur_words['subject']), $words_subject);
}
else
{
$words['add']['post'] = $words_message;
$words['add']['subject'] = $words_subject;
$words['del']['post'] = array();
$words['del']['subject'] = array();
}
unset($words_message);
unset($words_subject);
// Get unique words from the above arrays
$unique_words = array_unique(array_merge($words['add']['post'], $words['add']['subject']));
if (!empty($unique_words))
{
$result = $db->query('SELECT id, word FROM '.$db->prefix.'search_words WHERE word IN('.implode(',', preg_replace('#^(.*)$#', '\'\1\'', $unique_words)).')') or error('Unable to fetch search index words', __FILE__, __LINE__, $db->error());
$word_ids = array();
while ($row = $db->fetch_row($result))
$word_ids[$row[1]] = $row[0];
$db->free_result($result);
$new_words = array_diff($unique_words, array_keys($word_ids));
unset($unique_words);
if (!empty($new_words))
{
switch ($db_type)
{
case 'mysql':
$result = $db->query('INSERT INTO '.$db->prefix.'search_words (word) VALUES'.implode(',', preg_replace('#^(.*)$#', '(\'\1\')', $new_words))) or error('Unable to insert search index words', __FILE__, __LINE__, $db->error());
break;
default:
foreach ($new_words as $word)
$result = $db->query('INSERT INTO '.$db->prefix.'search_words (word) VALUES(\''.$word.'\')') or error('Unable to insert search index words', __FILE__, __LINE__, $db->error());
break;
}
}
unset($new_words);
}
// Delete matches (only if editing a post)
foreach ($words['del'] as $match_in => $wordlist)
{
$subject_match = ($match_in == 'subject') ? 1 : 0;
if (!empty($wordlist))
{
foreach ($wordlist as $word)
$sql .= (($sql != '') ? ',' : '').$cur_words[$match_in][$word];
$db->query('DELETE FROM '.$db->prefix.'search_matches WHERE word_id IN('.$sql.') AND post_id='.$post_id.' AND subject_match='.$subject_match) or error('Unable to delete search index word matches', __FILE__, __LINE__, $db->error());
}
}
// Add new matches
foreach ($words['add'] as $match_in => $wordlist)
{
$subject_match = ($match_in == 'subject') ? 1 : 0;
if (!empty($wordlist))
$result = $db->query('INSERT INTO '.$db->prefix.'search_matches (post_id, word_id, subject_match) SELECT '.$post_id.', id, '.$subject_match.' FROM '.$db->prefix.'search_words WHERE word IN('.implode(',', preg_replace('#^(.*)$#', '\'\1\'', $wordlist)).')') or error('Unable to insert search index word matches', __FILE__, __LINE__, $db->error());
}
unset($words);
}
//
// Strip search index of indexed words in $post_ids
//
function strip_search_index($post_ids)
{
global $db_type, $db;
switch ($db_type)
{
case 'mysql':
{
$result = $db->query('SELECT word_id FROM '.$db->prefix.'search_matches WHERE post_id IN('.$post_ids.') GROUP BY word_id') or error('Unable to fetch search index word match', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
$word_ids = 0;
while ($row = $db->fetch_row($result))
$word_ids .= ($word_ids != '') ? ','.$row[0] : $row[0];
$result = $db->query('SELECT word_id FROM '.$db->prefix.'search_matches WHERE word_id IN('.$word_ids.') GROUP BY word_id HAVING COUNT(word_id)=1') or error('Unable to fetch search index word match', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
$word_ids = '';
while ($row = $db->fetch_row($result))
$word_ids .= ($word_ids != '') ? ','.$row[0] : $row[0];
if ($word_ids != '')
$db->query('DELETE FROM '.$db->prefix.'search_words WHERE id IN('.$word_ids.')') or error('Unable to delete search index word', __FILE__, __LINE__, $db->error());
}
}
break;
}
default:
$db->query('DELETE FROM '.$db->prefix.'search_words WHERE id IN(SELECT word_id FROM '.$db->prefix.'search_matches WHERE word_id IN(SELECT word_id FROM '.$db->prefix.'search_matches WHERE post_id IN('.$post_ids.') GROUP BY word_id) GROUP BY word_id HAVING COUNT(word_id)=1)') or error('Unable to delete from search index', __FILE__, __LINE__, $db->error());
break;
}
$db->query('DELETE FROM '.$db->prefix.'search_matches WHERE post_id IN('.$post_ids.')') or error('Unable to delete search index word match', __FILE__, __LINE__, $db->error());
}

View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

30
include/template/main.tpl Normal file
View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="{pun_content_direction}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={pun_char_encoding}">
{pun_head}
</head>
<body{pun_body}>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">
<span class="punheadline">{pun_title}</span><br>
{pun_desc}
</td>
</tr>
<tr>
<td class="puncon1">
{pun_navlinks}<br><br>
{pun_status}
</td>
</tr>
</table>
{pun_main}
{pun_footer}
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="{pun_content_direction}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={pun_char_encoding}">
{pun_head}
</head>
<body>
<table class="punmain" style="width: 60%" align="center" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">{pun_maint_heading}</td>
</tr>
<tr>
<td class="puncon1">{pun_maint_message}</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="{pun_content_direction}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={pun_char_encoding}">
{pun_head}
</head>
<body>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">{pun_redir_heading}</td>
</tr>
<tr>
<td class="puncon1">
{pun_redir_text}
</td>
</tr>
</table>
</body>
</html>

235
index.php Normal file
View File

@ -0,0 +1,235 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
@include 'config.php';
// If config.php doesn't exist, PUN shouldn't be defined
if (!defined('PUN'))
exit('config.php doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');
require 'include/common.php';
if ($cookie['is_guest'] && $permissions['guests_read'] == '0')
message($lang_common['Login required'].' <a href="login.php">'.$lang_common['Login'].'</a> '.$lang_common['or'].' <a href="register.php">'.$lang_common['register'].'</a>.');
// Load the index.php language file
require 'lang/'.$language.'/'.$language.'_index.php';
$page_title = htmlspecialchars($options['board_title']);
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 24px">&nbsp;</td>
<td class="punhead" style="white-space: nowrap"><?php print $lang_common['Forum'] ?></td>
<td class="punheadcent" style="width: 6%; white-space: nowrap"><?php print $lang_index['Topics'] ?></td>
<td class="punheadcent" style="width: 6%; white-space: nowrap"><?php print $lang_common['Posts'] ?></td>
<td class="punheadcent" style="width: 18%; white-space: nowrap"><?php print $lang_common['Last post'] ?></td>
<td class="punheadcent" style="width: 18%; white-space: nowrap"><?php print $lang_index['Moderators'] ?></td>
</tr>
<?php
// Print the categories and forums
$cur_category = null; // Define $cur_category before using it in the if statement
$extra = '';
if (isset($cur_user['status']) < 1)
$extra = ' WHERE c.admmod_only!=\'1\' AND f.admmod_only!=\'1\'';
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.closed FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra.' ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
while ($cur_forum = $db->fetch_assoc($result))
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
// ...
$cur_category = $cur_forum['cid'];
// ...
?>
<tr>
<td class="puncon3" colspan="6"><?php print htmlspecialchars($cur_forum['cat_name']) ?></td>
</tr>
<?php
$cur_category = $cur_forum['cid'];
}
if ($cur_forum['closed'] != '1')
$forum_field = '<span class="punheadline"><a href="viewforum.php?id='.$cur_forum['fid'].'">'.htmlspecialchars($cur_forum['forum_name']).'</a></span>';
else
$forum_field = '<span class="punheadline"><a class="punclosed" href="viewforum.php?id='.$cur_forum['fid'].'">'.htmlspecialchars($cur_forum['forum_name']).'</a></span>';
if ($cur_forum['forum_desc'] != '')
$forum_field .= '<br>'."\n\t\t\t".$cur_forum['forum_desc'];
// If there is a last_post/last_poster.
if ($cur_forum['last_post'] != '')
$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a><br>'.$lang_common['by'].' '.htmlspecialchars($cur_forum['last_poster']);
else
$last_post = '&nbsp;';
if (!$cookie['is_guest'] && $cur_forum['last_post'] > $cookie['last_timeout'])
{
if ($cur_user['show_img'] != '0')
$icon = '<img src="img/'.$cur_user['style'].'_new.png" width="16" height="16" alt="">';
else
$icon = '<span class="puntext"><b>&#8226;</b></span>';
}
else
$icon = '&nbsp;';
if ($cur_forum['moderators'] != '')
{
$mods_array = unserialize($cur_forum['moderators']);
$moderators = array();
while (list($mod_username, $mod_id) = @each($mods_array))
{
$mod_username = htmlspecialchars($mod_username);
$moderators[] = '<a href="profile.php?id='.$mod_id.'">'.$mod_username.'</a>';
}
$moderators = implode(', ', $moderators);
}
else
$moderators = '&nbsp;';
?>
<tr class="puncon1">
<td class="puncent"><?php print $icon ?></td>
<td>
<?php print $forum_field."\n" ?>
</td>
<td class="puncent"><?php print $cur_forum['num_topics'] ?></td>
<td class="puncent"><?php print $cur_forum['num_posts'] ?></td>
<td class="puncent"><?php print $last_post ?></td>
<td class="puncent"><?php print $moderators ?></td>
</tr>
<?php
}
print "</table>\n\n";
// Show what the current user can and cannot do
if (isset($cur_user) && isset($cur_user['status']) && $cur_user['status'] > 0) {
$perms = ($cur_user['status'] > 0)
? "{$lang_index['You']} <b>{$lang_index['can']}</b> {$lang_index['post replies']}<br>
{$lang_index['You']} <b>{$lang_index['can']}</b> {$lang_index['post topics']}<br>
{$lang_index['You']} <b>{$lang_index['can']}</b> {$lang_index['edit posts']}<br>
{$lang_index['You']} <b>{$lang_index['can']}</b> {$lang_index['delete posts']}<br>
{$lang_index['You']} <b>{$lang_index['can']}</b> {$lang_index['delete topics']}\n"
: '';
} else if (!$cookie['is_guest']) {
$perms = $lang_index['You'].' <b>'. (($permissions['users_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post replies'].'<br>';
$perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($permissions['users_post_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post topics'].'<br>';
$perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($permissions['users_edit_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['edit posts'].'<br>';
$perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($permissions['users_del_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['delete posts'].'<br>';
$perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($permissions['users_del_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['delete topics'].'<br>'."\n";
} else {
$perms = $lang_index['You'].' <b>'. (($permissions['guests_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post replies'].'<br>';
$perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($permissions['guests_post_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post topics'].'<br>';
$perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'.$lang_index['cannot'].'</b> '.$lang_index['edit posts'].'<br>'.$lang_index['You'].' <b>'.$lang_index['cannot'].'</b> '.$lang_index['delete posts'].'<br>'.$lang_index['You'].' <b>'.$lang_index['cannot'].'</b> '.$lang_index['delete topics']."\n";
}
// Collect some statistics from the database
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
$stats['totalusers'] = $db->result($result, 0) - 1; // Minus the guest account
$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
$stats['lastuser'] = $db->fetch_assoc($result);
$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['totaltopics'], $stats['totalposts']) = $db->fetch_row($result);
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr>
<td class="puncon1">
<table class="punplain" cellspacing="0" cellpadding="0">
<tr>
<td class="puntop" style="margin-right: 40px">
<?php print $lang_index['This forum has'].' '.$stats['totalusers'].' '.(($stats['totalusers'] <> 1) ? $lang_index['registered users'] : $lang_index['registered users']).', '.$stats['totaltopics'].' '.(($stats['totaltopics'] <> 1) ? $lang_index['topics'] : $lang_index['topic']).' '.$lang_index['and'].' '.$stats['totalposts'].' '.(($stats['totalposts'] <> 1) ? $lang_index['posts'] : $lang_index['post']) ?>.<br>
<?php print $lang_index['Newest user'] ?> <a href="profile.php?id=<?php print $stats['lastuser']['id'] ?>"><?php print htmlspecialchars($stats['lastuser']['username']) ?></a>.
<?php
if ($options['users_online'] == '1') {
// Fetch users online info and generate strings for output.
$num_guests = 0;
$users = array();
$result = $db->query('SELECT user_id, ident, logged FROM '.$db->prefix.'online ORDER BY ident');
if (!$result) {
throw new Exception('Unable to fetch online list: ' . $db->error());
}
while ($cur_user_online = $result->fetch_array(MYSQLI_ASSOC)) {
if ($cur_user_online['user_id'] > 0) {
$users[] = '<a href="profile.php?id='.$cur_user_online['user_id'].'">'.htmlspecialchars($cur_user_online['ident']).'</a>';
} else {
$num_guests++;
}
}
$num_users = count($users);
echo "\t\t\t\t\t\t".'<br>'.$lang_index['Currently serving'].' '.$num_users.' '.(($num_users != 1) ? $lang_index['registered users'] : $lang_index['registered user']).' '.$lang_index['and'].' '.$num_guests.' '.(($num_guests != 1) ? $lang_index['guests'] : $lang_index['guest']).'.';
if ($num_users) {
echo '<br><br>'."\n\t\t\t\t\t\t".implode(', ', $users)."\n";
} else {
echo "\n";
}
}
?>
</td>
<td class="puntopright" style="white-space: nowrap">
<?php print $perms ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
$footer_style = 'index';
require 'footer.php';

1060
install.php Normal file

File diff suppressed because it is too large Load Diff

99
lang/en/en_common.php Normal file
View File

@ -0,0 +1,99 @@
<?php
// Language definitions for frequently used strings
$lang_common = array(
// Text orientation and encoding
'lang_direction' => 'LTR',
'lang_encoding' => 'iso-8859-1',
// Notices
'Bad request' => 'Bad request. The link you followed is incorrect or outdated.',
'No permission' => 'You do not have permission to access this page.',
'Bad referer' => 'Bad referer. You were referred to this page from an unauthorized source. Please go back and try again. If the problem persists please make sure that \'Base URL\' is correctly set in Admin/Options and that you are visiting the forum by navigating to that URL.',
// Miscellaneous (used in many scripts)
'Options' => 'Options',
'Actions' => 'Actions',
'Submit' => 'Submit', // "name" of submit buttons
'Banned message' => 'You are banned from this forum. If you have any questions you can contact the forum administrator at',
'Never' => 'Never',
'Today' => 'Today',
'Yesterday' => 'Yesterday',
'First page' => 'First&nbsp;page',
'Last page' => 'Last&nbsp;page',
'Info' => 'Info', // a common table header
'Go back' => 'Go back',
'Maintenance' => 'Maintenance',
'Redirecting' => 'Redirecting',
'Click redirect' => 'Click here if you do not want to wait any longer (or if your browser does not automatically forward you)',
'Login required' => 'Only logged in users are allowed to read this forum.',
'Login' => 'Login',
'or' => 'or',
'register' => 'register',
'on' => 'on', // as in "BBCode is on"
'off' => 'off',
'Invalid e-mail' => 'The e-mail address you entered is invalid.',
'required field' => 'is a required field in this form.', // for javascript form validation
'Last post' => 'Last post',
'by' => 'by', // as in last post by someuser
'Username' => 'Username',
'E-mail' => 'E-mail',
'Registered' => 'Registered',
'Message' => 'Message',
'Topic' => 'Topic',
'Forum' => 'Forum',
'Posts' => 'Posts',
'Replies' => 'Replies',
'Author' => 'Author',
'Pages' => 'Pages',
'and' => 'and',
// Title
'Title' => 'Title',
'Member' => 'Member', // Default title
'Moderator' => 'Moderator',
'Administrator' => 'Administrator',
'Banned' => 'Banned',
'Guest' => 'Guest',
// Stuff for include/parser.php
'BBCode error' => 'The BBCode syntax in the message is incorrect.',
'BBCode error 1' => 'Missing start tag for [/quote].',
'BBCode error 2' => 'Missing end tag for [code].',
'BBCode error 3' => 'Missing start tag for [/code].',
'BBCode error 4' => 'Missing one or more end tags for [quote].',
'BBCode error 5' => 'Missing one or more start tags for [/quote].',
// Stuff for the navigator (top of every page)
'Home' => 'Home',
'User list' => 'User list',
'Rules' => 'Rules',
'Search' => 'Search',
'Register' => 'Register',
'Login' => 'Login',
'Not logged in' => 'You are not logged in.',
'Profile' => 'Profile',
'Logout' => 'Logout',
'Logged in as' => 'Logged in as',
'Admin' => 'Admin',
'Last visit' => 'Last visit',
// Stuff for the page footer
'Show new posts' => 'Show new posts since last visit',
'Show unanswered posts' => 'Show unanswered posts',
'Show your posts' => 'Show your posts',
'Mark all as read' => 'Mark all forums as read',
'Jump to' => 'Jump to',
'Go' => ' Go ', // submit button in forum jump
'Move topic' => 'Move topic',
'Open topic' => 'Open topic',
'Close topic' => 'Close topic',
'Unstick topic' => 'Unstick topic',
'Stick topic' => 'Stick topic',
'Edit subscribers' => 'Edit subscribers'
);
$lang_direction = 'LTR';
$lang_encoding = 'iso-8859-1';

12
lang/en/en_delete.php Normal file
View File

@ -0,0 +1,12 @@
<?php
// Language definitions used in delete.php
$lang_delete = array(
'Delete post' => 'Delete post',
'Warning' => 'Warning! If this is the first post in the topic, the whole topic will be deleted.',
'Delete' => 'Delete', // The submit button
'Post del redirect' => 'Post deleted. Redirecting ...',
'Topic del redirect' => 'Topic deleted. Redirecting ...'
);

21
lang/en/en_edit.php Normal file
View File

@ -0,0 +1,21 @@
<?php
// Language definitions used in edit.php
$lang_edit = array(
// Post validation stuff (many are similiar to those in $language_post.php)
'No subject' => 'Topics must contain a subject.',
'Too long subject' => 'Subjects cannot be longer than 70 characters.',
'No caps subject' => 'Subjects must not contain only capital letters and special characters in this forum.',
'No message' => 'You must enter a message.',
'Too long message' => 'Posts cannot be longer that 65535 characters (64 Kb).',
'No caps message' => 'Messages must not contain only capital letters and special characters in this forum.',
// Miscellaneous
'Show smilies' => 'Show smilies',
'Silent edit' => 'Silent edit (don\'t display "Edited by ..." in topic view)',
'Edit message' => 'Edit message',
'Subject' => 'Subject',
'Edit redirect' => 'Post updated. Redirecting ...'
);

14
lang/en/en_forum.php Normal file
View File

@ -0,0 +1,14 @@
<?php
// Language definitions used in viewforum.php
$lang_forum = array(
'Post topic' => 'Post new topic',
'Forum closed' => 'Forum closed',
'Moderated by' => 'Moderated by',
'Views' => 'Views',
'Moved' => 'Moved',
'Sticky' => 'Sticky',
'Empty forum' => 'Forum is empty.'
);

41
lang/en/en_help.php Normal file
View File

@ -0,0 +1,41 @@
<?php
// Language definitions used in help.php
$lang_help = array(
'Help' => 'Help',
'produces' => 'produces',
'BBCode' => 'BBCode',
'BBCode info 1' => 'BBCode is a collection of formatting tags that are used to change the look of text in this forum. BBCode is based on the same principal as, and is very similar to, HTML. Below is a list of all the available BBCodes and instructions on how to use them.',
'BBCode info 2' => 'Administrators have the ability to enable or disable BBCode. You can tell if BBCode is enabled or disabled out in the left margin whenever you post a message or edit your signature.',
'Text style' => 'Text style',
'Text style info' => 'The following tags change the appearance of text:',
'Bold text' => 'Bold text',
'Underlined text' => 'Underlined text',
'Italic text' => 'Italic text',
'Red text' => 'Red text',
'Links and images' => 'Links and images',
'Links info' => 'You can create links to other documents or to e-mail adresses using the following tags:',
'My e-mail address' => 'My e-mail address',
'Images info' => 'If you want to display an image you can use the img tag:',
'Quotes and code' => 'Quotes and code',
'Quotes info' => 'If you want to quote someone, you should use the quote tag:',
'Quote text' => 'This is the text i want to quote.',
'produces quote box' => 'produces a quote box like this:',
'Code info' => 'When displaying source code you should make sure that you use the code tag. Text displayed with the code tag will not be affected by other tags.',
'Code text' => 'This is some code.',
'produces code box' => 'produces a code box like this:',
'Nested tags' => 'Nested tags',
'Nested tags info' => 'BBCode can be nested to create more advanced formatting. For example:',
'Bold, underlined text' => 'Bold, underlined text',
'Smilies' => 'Smilies',
'Smilies info' => 'If you like (and if it is enabled), the forum can convert a series of smilies to images representations of that smiley. This forum recognizes the following smilies and converts them to an image:'
);

29
lang/en/en_index.php Normal file
View File

@ -0,0 +1,29 @@
<?php
// Language definitions used in index.php
$lang_index = array(
'Topics' => 'Topics',
'Moderators' => 'Moderators',
'You' => 'You',
'can' => 'can',
'cannot' => 'cannot',
'post replies' => 'post replies to topics',
'post topics' => 'post new topics',
'edit posts' => 'edit your posts',
'delete posts' => 'delete your posts',
'delete topics' => 'delete your topics',
'This forum has' => 'This forum has',
'registered user' => 'registered user',
'registered users' => 'registered users', // plural
'topic' => 'topic',
'topics' => 'topics', // plural
'and' => 'and',
'post' => 'post',
'posts' => 'posts', // plural
'Newest user' => 'The newest registered user is',
'Currently serving' => 'Currently serving',
'guest' => 'guest',
'guests' => 'guests' // plural
);

28
lang/en/en_login.php Normal file
View File

@ -0,0 +1,28 @@
<?php
// Language definitions used in delete.php
$lang_login = array(
// Miscellaneous
'Wrong user/pass' => 'Wrong username and/or password.',
'Forgotten pass' => 'Forgotten your password?',
'Login redirect' => 'Logged in successfully. Redirecting ...',
'Logout redirect' => 'Logged out. Redirecting ...',
'No e-mail match' => 'There is no user registered with the email address',
'Request pass' => 'Request password',
'Instructions' => 'Enter the e-mail address with which you registered. A new password together with a link to activate the new password will be sent to that address.',
'Password' => 'Password',
'Not registered' => 'Not registered yet?',
// Forget password mail stuff
'Forget mail 1' => 'New password requested',
'Forget mail 2' => 'Hello', // as in "Hello someuser"
'Forget mail 3' => 'You have requested to have a new password assigned to your account in the discussion forum at',
'Forget mail 4' => 'If you didn\'t request this or if you don\'t want to change your password you should just ignore this message. Only if you visit the activation URL below will your password be changed.',
'Forget mail 5' => 'To change your password, please visit the URL below:',
'Forget mail 6' => 'When you have visited the above URL you can login with your new password:',
'Forget mail 7' => 'Do not reply to this message',
'Forget mail 8' => 'An email has been sent to',
'Forget mail 9' => 'with instructions on how to change your password. If it doesn\'t arrive you can contact the forum administrator at'
);

17
lang/en/en_misc.php Normal file
View File

@ -0,0 +1,17 @@
<?php
// Language definitions used in delete.php
$lang_misc = array(
'Mark read redirect' => 'All forums and posts have been marked as read. Redirecting ...',
'No reason' => 'You must enter a reason.',
'Report redirect' => 'Post reported. Redirecting ...',
'Report post' => 'Report post',
'Reason' => 'Reason',
'Reason desc' => 'Please enter a short reason why you are reporting this post.',
'Already subscribed' => 'You are already subscribed to this topic.',
'Subscribe redirect' => 'Your subscription has been added. Redirecting ...',
'Not subscribed' => 'You are not subscribed to this topic.',
'Unsubscribe redirect' => 'Your subscription has been removed. Redirecting ...'
);

34
lang/en/en_post.php Normal file
View File

@ -0,0 +1,34 @@
<?php
// Language definitions used in post.php
$lang_post = array(
// Post validation stuff (many are similiar to those in $language_edit.php)
'No subject' => 'Topics must contain a subject.',
'Too long subject' => 'Subjects cannot be longer than 70 characters.',
'No caps subject' => 'Subjects must not contain only capital letters and special characters in this forum.',
'No message' => 'You must enter a message.',
'Too long message' => 'Posts cannot be longer that 65535 characters (64 Kb).',
'No caps message' => 'Messages must not contain only capital letters and special characters in this forum.',
// Subscription mail stuff
'Reply mail 1' => 'Reply to topic',
'Reply mail 2' => 'replied to the topic',
'Reply mail 3' => 'to which you are subscribed.',
'Reply mail 4' => 'The post is located at',
'Reply mail 5' => 'You can unsubscribe by going to',
'Reply mail 6' => 'Do not reply to this message',
// Miscellaneous
'Post redirect' => 'Post entered. Redirecting ...',
'Post a reply' => 'Post a reply',
'Post new topic' => 'Post new topic',
'wrote' => 'wrote', // For [quote]'s
'Show smilies' => 'Show smilies as icons',
'Subscribe' => 'Subscribe to this topic',
'Subject' => 'Subject',
'Topic review' => 'Topic review (newest first)',
'Flood start' => 'At least',
'flood end' => 'seconds have to pass between posts. Please wait a little while and try posting again.'
);

32
lang/en/en_prof_reg.php Normal file
View File

@ -0,0 +1,32 @@
<?php
// Language definitions used in both profile.php and register.php
$lang_prof_reg = array(
'Password' => 'Password',
'Timezone' => 'Timezone',
'Timezone info' => 'In order for the forum to display times correctly, you must select the timezone you are visiting from.',
'Hide e-mail' => 'Hide e-mail address from other users.',
'Hide e-mail info' => 'If you don\'t want other users to be able to see your e-mail address, you should make sure that this option is enabled. If you don\'t select it, users will be able to see your e-mail address in your profile and in your posts.',
'Save user/pass' => 'Save username and password between visits.',
'Save user/pass info' => 'This option sets whether the forum should "remember" you between visits. If enabled, you will not have to login every time you want to visit the forum. You will be logged in automatically. This feature uses cookies and thus, requires your browser to have cookies enabled. Recommended.',
'Re-enter pass' => 'Re-enter password to confirm.',
'Username too short' => 'Usernames must be at least 2 characters long. Please choose another (longer) username.',
'Username guest' => 'The username guest is reserved. Please choose another username.',
'Username IP' => 'Usernames may not be in the form of an IP address. Please choose another username.',
'Username BBCode' => 'Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please choose another username.',
'Dupe username' => 'Someone else has already registered with that username. Please choose another username.',
'Pass too short' => 'Passwords must be at least 4 characters long. Please choose another (longer) password.',
'Pass not match' => 'Passwords do not match. Please go back and correct.',
'Banned e-mail' => 'The e-mail address you entered is banned in this forum. Please choose another e-mail address.',
'Dupe e-mail' => 'Someone else is already registered with that e-mail address. Please choose another e-mail address.',
'Sig too long' => 'Signatures cannot be longer than',
'characters' => 'characters',
'Sig too many lines' => 'Signatures cannot have more than',
'lines' => 'lines',
'Sig caps' => 'Signatures must not contain only capital letters and special characters. Please go back and correct.',
'Signature quote/code' => 'The quote and code BBCodes are not allowed in signatures. Please go back and correct.',
'Bad ICQ' => 'You entered an invalid ICQ UIN. Please go back and correct.'
);

115
lang/en/en_profile.php Normal file
View File

@ -0,0 +1,115 @@
<?php
// Language definitions used in profile.php
$lang_profile = array(
// Miscellaneous
'Profile' => 'Profile',
// Password stuff
'Pass key bad' => 'The specified password activation key was incorrect or has expired. Please re-request a new password. If that fails, contact the forum administrator at',
'Pass updated' => 'Your password has been updated. You can now login with your new password.',
'Pass updated redirect' => 'Password updated. Redirecting ...',
'Wrong pass' => 'Wrong old password.',
'Change pass' => 'Change password',
'Old pass' => 'Old password',
'New pass' => 'New password',
// E-mail stuff
'E-mail key bad' => 'The specified e-mail activation key was incorrect or has expired. Please re-request change of e-mail adress. If that fails, contact the forum administrator at',
'E-mail updated' => 'Your e-mail address has been updated.',
'Change mail 1' => 'Change e-mail address requested',
'Change mail 2' => 'Hello', // as in "Hello $username"
'Change mail 3' => 'You have requested to have a new e-mail address assigned to your account in the discussion forum at',
'Change mail 4' => 'Only if you visit the activation URL below will your e-mail address be changed. In order for the activation URL to work, you must be logged in to the forum.',
'Change mail 5' => 'To change your e-mail address, please visit the URL below:',
'Change mail 6' => 'Do not reply to this message',
'Change mail 7' => 'An email has been sent to',
'Change mail 8' => 'with instructions on how to activate the new e-mail address. If it doesn\'t arrive you can contact the forum administrator at',
'E-mail instructions' => 'Enter the new e-mail address and an e-mail will be sent to that address with an activation link. You must click the link in the e-mail you recieve to activate the new address.',
'Change e-mail' => 'Change e-mail address',
'New e-mail' => 'New e-mail',
// Avatar upload stuff
'Avatars disabled' => 'The administrator has disabled avatar support.',
'Too large ini' => 'The selected file was too large to upload. The server didn\'t allow the upload.',
'Partial upload' => 'The selected file was only partially uploaded. Please try again.',
'No file' => 'You did not select a file for upload.',
'Bad type' => 'The file you tried to upload is not of an allowed type. Allowed types are gif, jpeg and png.',
'Too wide' => 'The file you tried to upload is wider than the maximum allowed',
'Too high' => 'The file you tried to upload is higher than the maximum allowed',
'Too large' => 'The file you tried to upload is larger than the maximum allowed',
'pixels' => 'pixels',
'bytes' => 'bytes',
'Move failed' => 'The server was unable to save the uploaded file. Please contact the forum administrator at',
'Unknown failure' => 'An unknown error occured. Please try again.',
'Upload redirect' => 'Avatar uploaded. Redirecting ...',
'Avatar desc' => 'An avatar is a small image that will be displayed under your username in your posts. It must not be any bigger than',
'Upload avatar' => 'Upload avatar',
'File' => 'File',
'Upload' => 'Upload', // submit button
// Form validation stuff
'Dupe username' => 'Someone else has already registered with that username. Please go back and try a different username.',
'Forbidden title' => 'The title you entered contains a forbidden word. You must choose a different title.',
'Profile redirect' => 'Profile updated. Redirecting ...',
// Profile display stuff
'Not activated' => 'This user hasn\'t activated his/her account yet. The account is activated when he/she logs in the first time.',
'Not displayed' => 'Not displayed',
'No avatar' => 'No avatar',
'Show posts' => 'Show posts by this user',
'Realname' => 'Realname',
'Website' => 'Website',
'ICQ' => 'ICQ',
'AOL IM' => 'AOL IM',
'Yahoo' => 'Yahoo! Messenger',
'Location' => 'Location',
'Sig max length' => 'Max length',
'Sig max lines' => 'Max lines',
'Avatar' => 'Avatar',
'Avatar info' => 'An avatar is a small image that will be displayed with all your posts. You can upload an avatar by clicking the link below. The checkbox \'Use avatar\' below must be checked in order for the avatar to be visible in your posts.',
'Change avatar' => 'Change avatar',
'Use avatar' => 'Use avatar.',
'Signature' => 'Signature',
'Signature info' => 'A signature is a small piece of text that is attached to your posts. In it, you can enter just about anything you like. Perhaps you would like to enter your favorite quote or your star sign. It\'s up to you! In your signature you can use embedded HTML or BBCode depending on the what is allowed in this particular forum. You can tell what features are allowed/enabled out in the left margin whenever you edit your signature.',
'Sig preview' => 'Current signature preview:',
'No sig' => 'No signature currently stored in profile.',
'Topics per page' => 'Topics per page',
'Topics per page info' => 'This setting controls how many topics are displayed per page when you view a forum. If you are uncertain about what to use, you can just leave it blank and the forum default will be used.',
'Posts per page' => 'Posts per page',
'Posts per page info' => 'This setting controls how many posts are displayed per page when you view a topic. If you are uncertain about what to use, you can just leave it blank and the forum default will be used.',
'Leave blank' => 'Leave blank to use forum default.',
'Use smilies' => 'Convert smilies to images by default.',
'Use smilies info' => 'If you enable this option, small images instead of text smilies will be displayed in your posts by default. You can still disable this by unchecking the checkbox on a post per post basis.',
'Show images' => 'Show images.',
'Show images info' => 'Disable this if you don\'t want to see images and icons in posts (this includes smilies and images displayed with the [img]-tag).',
'Show sigs' => 'Show user signatures.',
'Show sigs info' => 'Enable if you would like to see user signatures.',
'Open links new win' => 'Open links in new window.',
'Open links new win info' => 'This option sets whether you want links in posts to open new windows or not.',
'Style' => 'Style',
'Style info' => 'If you like you can use a different visual style for this forum.',
'Admin note' => 'Admin note',
'Instructions' => 'When you update your profile, you will be redirected back to this page.',
// Administration stuff
'User admin' => 'User administration',
'Choose status' => 'Status',
'Choose status info' => 'Choose what status this user should have.',
'Update status' => 'Update status',
'Moderator in' => 'Moderator in',
'Moderator in info' => 'Choose what forums this user should be allowed to moderate. Note: This only applies to moderators.',
'Update forums' => 'Update forums',
'Delete user' => 'Delete user',
'Ban user' => 'Ban user',
'Confirm delete user' => 'Confirm delete user',
'Are you sure' => 'Are you sure that you want to delete this user?',
'Warning' => 'Warning! Deleted users cannot be restored.',
'OK' => ' OK ', // submit button (confirm user delete)
'User delete redirect' => 'User deleted. Redirecting ...',
'Update status redirect' => 'User status updated. Redirecting ...',
'Update forums redirect' => 'Forum moderator rights updated. Redirecting ...',
'Ban redirect' => 'Redirecting ...'
);

42
lang/en/en_register.php Normal file
View File

@ -0,0 +1,42 @@
<?php
// Language definitions used in register.php
$lang_register = array(
// Miscellaneous
'No new regs' => 'This forum is not accepting new registrations.',
'Reg cancel redirect' => 'Registration cancelled. Redirecting ...',
'Forum rules' => 'Forum rules',
'Accept' => 'Agree',
'Cancel' => 'Cancel',
'Register' => 'Register',
// Form validation stuff (some of these are also used in post.php)
'Username censor' => 'The username you entered contained one or more censored words. Please choose another username.',
'Username dupe 1' => 'Someone else has registered with the username',
'Username dupe 2' => 'The username you entered is too similar. The username must differ from that by at least one alphanumerical character (a-z or 0-9). Please go back and try a different username.',
'E-mail not match' => 'E-mail addresses do not match. Please go back and correct.',
// Registration e-mail stuff
'Reg e-mail 1' => 'Welcome!',
'Reg e-mail 2' => 'Thank you for registering at',
'Reg e-mail 3' => 'Your username is',
'Reg e-mail 4' => 'Your password is',
'Reg e-mail 5' => 'Login at',
'Reg e-mail 6' => 'to activate the account.',
'Reg e-mail 7' => 'Do not reply to this message',
'Reg e-mail 8' => 'Thank you for registering. Your password has been sent to',
'Reg e-mail 9' => 'If it doesn\'t arrive you can contact the forum administrator at',
'Reg complete' => 'Registration complete. Logging in and redirecting ...',
// Register info
'Desc 1' => 'Registering is not required, but it will grant you access to a number of features and capabilities otherwise unavailable. These functions include the ability to edit and delete posts, design your own signature that accompanies your posts and much more. If you have any questions regarding this forum you should ask an administrator.',
'Desc 2' => 'Below is a form you must fill out in order to register. Once you are registered you should visit your profile and review the different settings you can change. The fields below only make up a small part of all the settings you can alter in your profile.',
'Username info' => 'Usernames can be between 2 and 25 characters long.',
'Pass info 1' => 'Passwords can be between 4 and 16 characters long. Passwords are case sensitive.',
'Pass info 2' => 'The forum will generate a random password that will be e-mailed to you as you register. You can then log in with this password and change it to whatever you like in your profile.',
'E-mail info 1' => 'You must enter a valid e-mail address as your password will be sent to that address (see above). You can choose to hide your e-mail address from other users (see below) to keep your privacy.',
'E-mail info 2' => 'Please enter a valid e-mail address. You can choose to hide your e-mail address from other users (see below) to keep your privacy.',
'Re-enter e-mail' => 'Re-enter e-mail address to confirm.',
);

39
lang/en/en_search.php Normal file
View File

@ -0,0 +1,39 @@
<?php
// Language definitions used in search.php
$lang_search = array(
'Search disabled' => 'The administrator has disabled the search feature.',
'No guest search' => 'Guests are not allowed to use the search feature.',
'Search' => 'Search',
'Keyword search' => 'Keywords',
'Keyword search info' => 'Enter a term or terms to search for. Separate terms with spaces. Use AND, OR and NOT to refine your search. Use the wildcard character * for partial matches.',
'Author search' => 'Author search',
'Author search info' => 'Enter the username of the author whose posts you wish to search for. Use wildcard character * for partial matches.',
'Search in' => 'Search in',
'Message and subject' => 'Message text and topic subject',
'Message only' => 'Message text only',
'Topic only' => 'Topic subject only',
'Forum search' => 'Forum',
'All forums' => 'All forums',
'Sort by' => 'Sort/group by',
'Sort by post time' => 'Post time',
'Sort by author' => 'Author',
'Sort by subject' => 'Subject',
'Sort by forum' => 'Forum',
'Ascending' => 'Ascending',
'Descending' => 'Descending',
'Show as' => 'Show results as',
'Show as topics' => 'Topics',
'Show as posts' => 'Posts',
'No terms' => 'You have to enter at least one keyword and/or an author to search for.',
'No hits' => 'Your search returned no hits.',
'Search results' => 'Search results',
'Topic/Message' => 'Topic/Message',
'User no posts' => 'There are no posts by this user in this forum.',
'Go to post' => 'Go to post',
'No new posts' => 'There are no topics with new posts since your last visit.',
'No unanswered' => 'There are no unanswered posts in this forum.'
);

151
lang/en/en_stopwords.txt Normal file
View File

@ -0,0 +1,151 @@
about
after
ago
all
almost
along
also
and
any
anybody
anywhere
are
arent
around
ask
bad
been
before
being
between
but
came
can
cant
come
could
couldnt
did
didnt
does
dont
each
either
else
even
every
everybody
everyone
find
for
from
get
going
gone
got
had
has
have
havent
having
her
here
hers
him
his
how
into
isnt
its
just
know
less
like
make
many
may
more
most
much
must
near
never
none
not
nothing
off
often
once
one
only
other
our
ours
out
over
please
rather
recent
said
see
she
should
small
some
something
sometime
somewhere
take
than
thank
thanks
that
the
their
theirs
them
then
there
these
they
thing
this
those
though
through
thus
too
true
two
under
until
upon
use
very
want
was
way
were
what
when
where
which
who
whom
whose
why
will
with
within
without
would
yes
yet
you
your
yours
lol
quote
code
img
wrote

23
lang/en/en_topic.php Normal file
View File

@ -0,0 +1,23 @@
<?php
// Language definitions used in viewtopic.php
$lang_topic = array(
'Post reply' => 'Post reply',
'Topic closed' => 'Topic closed',
'Moderated by' => 'Moderated by',
'From' => 'From', // User location
'Note' => 'Note', // Admin note
'Website' => 'Website',
'Guest' => 'Guest',
'Last edit' => 'Last edited by',
'Report' => 'Report',
'Delete' => 'Delete',
'Edit' => 'Edit',
'Quote' => 'Quote',
'Is subscribed' => 'You are currently subscribed to this topic',
'Unsubscribe' => 'Unsubscribe',
'Subscribe' => 'Subscribe to this topic',
'Quick post' => 'Quick post'
);

12
lang/en/en_userlist.php Normal file
View File

@ -0,0 +1,12 @@
<?php
// Language definitions used in userlist.php
$lang_ul = array(
'User list' => 'User list',
'Other' => 'Other',
'All users' => 'All users',
'No users' => 'There are no registered users under',
'Not displayed' => 'Not displayed'
);

8
lang/en/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

8
lang/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

219
login.php Normal file
View File

@ -0,0 +1,219 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
if (isset($_GET['action']))
define('PUN_DONT_UPDATE_COOKIE', 1);
require 'include/common.php';
$action = isset($_GET['action']);
// Load the login.php language file
require 'lang/'.$language.'/'.$language.'_login.php';
if (isset($_POST['form_sent']) && $action == 'in')
{
$username = un_escape(trim($_POST['req_username']));
$password = un_escape(trim($_POST['req_password']));
$result = $db->query('SELECT id, username, password, save_pass, status FROM '.$db->prefix.'users WHERE username=\''.addslashes($username).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
list($user_id, $correct_username, $correct_password, $save_pass, $status) = $db->fetch_row($result);
if ($correct_password == NULL || $correct_password != md5($password))
message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>');
// Update the status if this is the first time the user logged in
if ($status == -1)
$db->query('UPDATE '.$db->prefix.'users SET status=0 WHERE id='.$user_id) or error('Unable to update user status', __FILE__, __LINE__, $db->error());
$expire = ($save_pass == '1') ? time() + 31536000 : 0;
if (isset($_COOKIE['punbb_cookie']))
{
list(, , $last_action, $last_timeout) = unserialize(un_escape($_COOKIE['punbb_cookie']));
setcookie('punbb_cookie', serialize(array($correct_username, $correct_password, $last_action, $last_timeout)), $expire, $cookie_path, $cookie_domain, $cookie_secure);
}
else
{
$now = time();
setcookie('punbb_cookie', serialize(array($correct_username, $correct_password, $now, $now)), $expire, $cookie_path, $cookie_domain, $cookie_secure);
}
redirect($_POST['redirect_url'], $lang_login['Login redirect']);
}
else if ($action == 'out')
{
if ($cookie['is_guest'])
header('Location: index.php');
// Remove user from "users online" list.
$db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.addslashes($cookie['username']).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
// Remove any left over search results
$db->query('DELETE FROM '.$db->prefix.'search_results WHERE ident=\''.addslashes($cookie['username']).'\'') or error('Unable to delete search results', __FILE__, __LINE__, $db->error());
list(, , $last_action, $last_timeout) = unserialize(un_escape($_COOKIE['punbb_cookie']));
setcookie('punbb_cookie', serialize(array('Guest', 'Guest', $last_action, $last_timeout)), time() + 31536000, $cookie_path, $cookie_domain, $cookie_secure);
redirect('index.php', $lang_login['Logout redirect']);
}
else if ($action == 'forget' || $action == 'forget_2')
{
if (isset($_POST['form_sent']))
{
require 'include/email.php';
// Validate the email-address
$email = strtolower(trim($_POST['req_email']));
if (!is_valid_email($email))
message($lang_common['Invalid e-mail']);
$result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.escape($email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
// Loop through users we found
while ($cur_hit = $db->fetch_assoc($result))
{
$new_password = random_pass(8);
$new_password_key = random_pass(8);
$db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.md5($new_password).'\', activate_key=\''.$new_password_key.'\' WHERE id='.$cur_hit['id']) or error('Unable to update activation data', __FILE__, __LINE__, $db->error());
$mail_subject = $lang_login['Forget mail 1'];
$mail_message = $lang_login['Forget mail 2'].' '.$cur_hit['username'].','."\r\r\n\n".$lang_login['Forget mail 3'].' '.$options['base_url'].'/. '.$lang_login['Forget mail 4']."\r\r\n\n".$lang_login['Forget mail 5']."\r\n".$options['base_url'].'/profile.php?id='.$cur_hit['id'].'&action=change_pass&key='.$new_password_key."\r\r\n\n".$lang_login['Forget mail 6'].' '.$new_password."\r\r\n\n".'/Forum Mailer'."\r\n".'('.$lang_login['Forget mail 7'].')';
$mail_extra = 'From: '.$options['board_title'].' Mailer <'.$options['webmaster_email'].'>';
pun_mail($email, $mail_subject, $mail_message, $mail_extra);
}
message($lang_login['Forget mail 8'].' '.$email.' '.$lang_login['Forget mail 9'].' <a href="mailto:'.$options['admin_email'].'">'.$options['admin_email'].'</a>.');
}
else
message($lang_login['No e-mail match'].' '.$email.'.');
}
else
{
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_login['Request pass'];
$validate_form = true;
$form_name = 'request_pass';
$focus_element = 'req_email';
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead"><?php print $lang_common['Info'] ?></td>
</tr>
<tr>
<td class="puncon2"><?php print $lang_login['Instructions'] ?></td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="login.php?action=forget_2" id="request_pass" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_login['Request pass'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_common['E-mail'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<input type="text" name="req_email" size="50" maxlength="50"></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2"><br>&nbsp;&nbsp;<input type="submit" name="request_pass" value="<?php print $lang_common['Submit'] ?>">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)"><?php print $lang_common['Go back'] ?></a><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
}
else
{
if (!$cookie['is_guest'])
header('Location: index.php');
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_common['Login'];
$validate_form = true;
$form_name = 'login';
$focus_element = 'req_username';
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="login.php?action=in" id="login" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<input type="hidden" name="redirect_url" value="<?php print $_SERVER["HTTP_REFERER"] ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_common['Login'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_common['Username'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<input type="text" name="req_username" size="25" maxlength="25"></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_login['Password'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<input type="password" name="req_password" size="16" maxlength="16"></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">
<br>&nbsp;&nbsp;<input type="submit" name="login" value="<?php print $lang_common['Login'] ?>"><br><br>
&nbsp;<a href="register.php"><?php print $lang_login['Not registered'] ?></a><br>
&nbsp;<a href="login.php?action=forget"><?php print $lang_login['Forgotten pass'] ?></a><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

220
misc.php Normal file
View File

@ -0,0 +1,220 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
if (isset($_GET['action']) && $_GET['action'] == 'markread')
define('PUN_DONT_UPDATE_COOKIE', 1);
require 'include/common.php';
$action = isset($_GET['action']);
// Load the misc.php language file
require 'lang/'.$language.'/'.$language.'_misc.php';
if ($action == 'rules')
message($options['rules_message']);
else if ($action == 'markread')
{
if ($cookie['is_guest'])
message($lang_common['No permission']);
$now = time();
$expire = ($cur_user['save_pass'] == '1') ? $now + 31536000 : 0;
setcookie('punbb_cookie', serialize(array($cookie['username'], $cookie['password'], $now, $now)), $expire, $cookie_path, $cookie_domain, $cookie_secure);
redirect('index.php', $lang_misc['Mark read redirect']);
}
if (isset($_GET['report']))
{
$report = intval($_GET['report']);
if (empty($report))
message($lang_common['Bad request']);
if ($cookie['is_guest'])
message($lang_common['No permission']);
if (isset($_POST['form_sent']))
{
$reason = str_replace("\r", "\n", str_replace("\r\n", "\n", trim($_POST['req_reason'])));
if ($reason == '')
message($lang_misc['No reason']);
// Get the topic ID
$result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$report) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$topic_id = $db->result($result, 0);
// Get the subject and forum ID
$result = $db->query('SELECT subject, forum_id FROM '.$db->prefix.'topics WHERE id='.$topic_id) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($subject, $forum_id) = $db->fetch_row($result);
// Should we use the internal report handling?
if ($options['report_method'] == 0 || $options['report_method'] == 2)
$db->query('INSERT INTO '.$db->prefix.'reports (post_id, topic_id, forum_id, reported_by, created, message) VALUES('.$report.', '.$topic_id.', '.$forum_id.', '.$cur_user['id'].', '.time().', \''.escape($reason).'\')' ) or error('Unable to create report', __FILE__, __LINE__, $db->error());
// Should we e-mail the report?
if ($options['report_method'] == 1 || $options['report_method'] == 2)
{
// We send it to the complete mailing-list in one swoop
if ($options['mailing_list'] != '')
{
$mail_subject = 'Report('.$forum_id.') - '.$subject;
$mail_message = $cur_user['username'].' has reported the following message:'."\r\n".$options['base_url'].'/viewtopic.php?pid='.$report.'#'.$report."\r\n\r\n".'Reason:'."\r\n".$reason;
$mail_extra = 'From: '.$options['board_title'].' Mailer <'.$options['webmaster_email'].'>';
require 'include/email.php';
pun_mail($options['mailing_list'], $mail_subject, $mail_message, $mail_extra);
}
}
if ($_POST['redirect_url'] != '')
redirect($_POST['redirect_url'], $lang_misc['Report redirect']);
else
redirect('viewtopic.php?id='.$topic_id, $lang_misc['Report redirect']);
}
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_misc['Report post'];
$validate_form = true;
$form_name = 'report';
$focus_element = 'req_reason';
$dimsubmit = true;
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="misc.php?report=<?php print $report ?>" id="report" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<input type="hidden" name="redirect_url" value="<?php print $_SERVER["HTTP_REFERER"] ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_misc['Report post'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_misc['Reason'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<?php print $lang_misc['Reason desc'] ?><br><br>
&nbsp;<textarea name="req_reason" rows="5" cols="60"></textarea>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2"><br>&nbsp;<input type="submit" name="comply" value="<?php print $lang_common['Submit'] ?>" accesskey="s">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)"><?php print $lang_common['Go back'] ?></a><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
else if (isset($_GET['subscribe']))
{
$subscribe = intval($_GET['subscribe']);
if (empty($subscribe))
message($lang_common['Bad request']);
if ($cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT subscribers FROM '.$db->prefix.'topics WHERE id='.$subscribe) or error('Unable to fetch topic subscribers', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$subscribers = $db->result($result, 0);
if ($subscribers == '')
$subscribers = escape($cur_user['email']);
else
{
if (!strstr($subscribers, $cur_user['email']))
$subscribers .= ','.$cur_user['email'];
else
message($lang_misc['Already subscribed']);
}
$db->query('UPDATE '.$db->prefix.'topics SET subscribers=\''.$subscribers.'\' WHERE id='.$subscribe) or error('Unable to update topic subscribers', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?id='.$subscribe, $lang_misc['Subscribe redirect']);
}
else if (isset($_GET['unsubscribe']))
{
$unsubscribe = intval($_GET['unsubscribe']);
if (empty($unsubscribe))
message($lang_common['Bad request']);
if ($cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT subscribers FROM '.$db->prefix.'topics WHERE id='.$unsubscribe) or error('Unable to fetch topic subscribers', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$subscribers = $db->result($result, 0);
if (strstr($subscribers, $cur_user['email']))
{
$addresses = explode(',', $subscribers);
while (list($key, $value) = @each($addresses))
{
if ($value == $cur_user['email'])
unset($addresses[$key]);
}
if (count($addresses))
{
$subscribers = implode(',', $addresses);
$db->query('UPDATE '.$db->prefix.'topics SET subscribers=\''.$subscribers.'\' WHERE id='.$unsubscribe) or error('Unable to update topic subscribers', __FILE__, __LINE__, $db->error());
}
else
$db->query('UPDATE '.$db->prefix.'topics SET subscribers=NULL WHERE id='.$unsubscribe) or error('Unable to update topic subscribers', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?id='.$unsubscribe, $lang_misc['Unsubscribe redirect']);
}
else
message($lang_misc['Not subscribed']);
}
else
message($lang_common['Bad request']);

261
moderate.php Normal file
View File

@ -0,0 +1,261 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
// This particular function doesn't require forum-based moderator access. It can be used
// by all moderators and admins.
if (isset($_GET['get_host']))
{
$get_host = intval($_GET['get_host']);
if (empty($get_host))
message($lang_common['Bad request']);
if ($cur_user['status'] < 1)
message($lang_common['No permission']);
$result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE id='.$get_host) or error('Unable to fetch post IP address', __FILE__, __LINE__, $db->error());
$ip = $db->result($result, 0);
message('The IP address is: '.$ip.'<br>The host name is: '.gethostbyaddr($ip).'<br><br><a href="admin_users.php?show_users='.$ip.'">Show more users for this IP</a>');
}
// All other functions require forum-based moderator access
$fid = intval($_GET['fid']);
if (empty($fid))
message($lang_common['Bad request']);
if (!is_admmod($fid, $foo, $foo))
message($lang_common['No permission']);
if (isset($_GET['move']))
{
if (isset($_POST['move_to']))
{
confirm_referer('moderate.php');
$move = intval($_GET['move']);
$move_to_forum = intval($_POST['move_to_forum']);
if (empty($move) || empty($move_to_forum))
message($lang_common['Bad request']);
// Delete a redirect topic if there is one (only if we moved/copied the topic back to where it where it was once moved from) (start transaction)
$db->query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to='.$move, PUN_TRANS_START) or error('Unable to delete redirect topic', __FILE__, __LINE__, $db->error());
// Move the topic
$db->query('UPDATE '.$db->prefix.'topics SET forum_id='.$move_to_forum.' WHERE id='.$move) or error('Unable to move topic', __FILE__, __LINE__, $db->error());
if ($_POST['with_redirect'] == '1')
{
// Fetch info for the redirect topic
$result = $db->query('SELECT poster, subject, posted, last_post FROM '.$db->prefix.'topics WHERE id='.$move) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
$moved_to = $db->fetch_assoc($result);
// Create the redirect topic
$db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, moved_to, forum_id) VALUES(\''.$moved_to['poster'].'\', \''.$moved_to['subject'].'\', '.$moved_to['posted'].', '.$moved_to['last_post'].', '.$move.', '.$fid.')') or error('Unable to create moved_to topic', __FILE__, __LINE__, $db->error());
}
update_forum($fid); // Update last_post in the forum FROM which the topic was moved/copied
update_forum($move_to_forum, PUN_TRANS_END); // Update last_post in the forum TO which the topic was moved/copied (end transaction)
redirect('viewforum.php?id='.$move_to_forum, 'Topic moved/copied. Redirecting ...');
}
else
{
$move = intval($_GET['move']);
if (empty($move))
message($lang_common['Bad request']);
$page_title = htmlspecialchars($options['board_title']).' / Moderate';
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="moderate.php?fid=<?php print $fid ?>&amp;move=<?php print $move ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead">Move topic</td>
</tr>
<tr>
<td class="puncon2">
<br>&nbsp;Move to&nbsp;&nbsp;<select name="move_to_forum">
<?php
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra.' ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
while ($cur_forum = $db->fetch_assoc($result))
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
if (!empty($cur_category))
print "\t\t\t\t\t".'</optgroup>'."\n";
print "\t\t\t\t\t".'<optgroup label="'.htmlspecialchars($cur_forum['cat_name']).'">'."\n";
$cur_category = $cur_forum['cid'];
}
if ($cur_forum['fid'] != $fid)
print "\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'">'.htmlspecialchars($cur_forum['forum_name']).'</option>'."\n";
}
?>
</optgroup>
</select><br><br>
<input type="checkbox" name="with_redirect" value="1" checked>&nbsp;Move with redirect (leave a redirect topic)<br><br>
&nbsp;&nbsp;<input type="submit" name="move_to" value="Move"><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
}
else if (isset($_GET['close']))
{
confirm_referer('viewtopic.php');
$close = intval($_GET['close']);
if (empty($close))
message($lang_common['Bad request']);
$db->query('UPDATE '.$db->prefix.'topics SET closed=\'1\' WHERE id='.$close) or error('Unable to close topic', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?id='.$close, 'Topic closed. Redirecting ...');
}
else if (isset($_GET['open']))
{
confirm_referer('viewtopic.php');
$open = intval($_GET['open']);
if (empty($open))
message($lang_common['Bad request']);
$db->query('UPDATE '.$db->prefix.'topics SET closed=\'0\' WHERE id='.$open) or error('Unable to open topic', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?id='.$open, 'Topic opened. Redirecting ...');
}
else if (isset($_GET['stick']))
{
confirm_referer('viewtopic.php');
$stick = intval($_GET['stick']);
if (empty($stick))
message($lang_common['Bad request']);
$db->query('UPDATE '.$db->prefix.'topics SET sticky=\'1\' WHERE id='.$stick) or error('Unable to stick topic', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?id='.$stick, 'Topic sticked. Redirecting ...');
}
else if (isset($_GET['unstick']))
{
confirm_referer('viewtopic.php');
$unstick = intval($_GET['unstick']);
if (empty($unstick))
message($lang_common['Bad request']);
$db->query('UPDATE '.$db->prefix.'topics SET sticky=\'0\' WHERE id='.$unstick) or error('Unable to unstick topic', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?id='.$unstick, 'Topic sticked. Redirecting ...');
}
else if (isset($_GET['edit_subscribers']))
{
$edit_subscribers = intval($_GET['edit_subscribers']);
if (empty($edit_subscribers))
message($lang_common['Bad request']);
if (isset($_POST['update']))
{
confirm_referer('moderate.php');
$subscribers = strtolower(preg_replace("/[\s]+/", '', trim($_POST['subscribers'])));
$subscribers = ($subscribers != '') ? '\''.$subscribers.'\'' : 'NULL';
$db->query('UPDATE '.$db->prefix.'topics SET subscribers='.$subscribers.' WHERE id='.$edit_subscribers) or error('Unable to update topic subscribers', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?id='.$edit_subscribers, 'Subscribers updated. Redirecting ...');
}
else
{
$page_title = htmlspecialchars($options['board_title']).' / Moderate';
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="moderate.php?fid=<?php print $fid ?>&amp;edit_subscribers=<?php print $edit_subscribers ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2">Edit subscribers</td>
</tr>
<?php
$result = $db->query('SELECT subscribers FROM '.$db->prefix.'topics WHERE id='.$edit_subscribers) or error('Unable to fetch topic subscribers', __FILE__, __LINE__, $db->error());
$subscribers = $db->result($result, 0);
?>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b>Subscribers</b>&nbsp;&nbsp;</td>
<td class="puncon2">
A comma-separated list of subscribed e-mail addresses.<br><br>
&nbsp;<textarea name="subscribers" rows="3" cols="80"><?php print $subscribers ?></textarea>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">Actions&nbsp;&nbsp;</td>
<td class="puncon2">
<br>&nbsp;<input type="submit" name="update" value="Update"><br><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
}
else
message($lang_common['Bad request']);

514
post.php Normal file
View File

@ -0,0 +1,514 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
if ($cookie['is_guest'] && $permissions['guests_read'] == '0')
message($lang_common['Login required'].' <a href="login.php">'.$lang_common['Login'].'</a> '.$lang_common['or'].' <a href="register.php">'.$lang_common['register'].'</a>.');
// Load the post.php language file
require 'lang/'.$language.'/'.$language.'_post.php';
if (isset($_POST['form_sent']))
{
// Flood protection
if (isset($cur_user['status']) < 1 && isset($cur_user['last_post']) != '' && (time() - $cur_user['last_post']) < $options['flood_interval'])
message($lang_post['Flood start'].' '.$options['flood_interval'].' '.$lang_post['flood end']);
// Make sure form_user is correct
if (($cookie['is_guest'] && $_POST['form_user'] != 'Guest') || (!$cookie['is_guest'] && $_POST['form_user'] != $cur_user['username']))
message($lang_common['Bad request']);
$smilies = $_POST['smilies'];
// If it's a reply
if (isset($_GET['tid']))
{
$tid = intval($_GET['tid']);
if (empty($tid))
message($lang_common['Bad request']);
if ($permissions['users_post'] == '0' && $cur_user['status'] < 1 || $permissions['guests_post'] == '0' && $cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT closed, forum_id FROM '.$db->prefix.'topics WHERE id='.$tid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($closed, $forum_id) = $db->fetch_row($result);
$forum_closed = '0';
if (!is_admmod($forum_id, $forum_closed, $admmod_only))
{
if ($admmod_only == '1' && $cur_user['status'] < 1 || $closed == '1' || $forum_closed == '1')
message($lang_common['No permission']);
}
}
// If it's a new topic
else if (isset($_GET['fid']))
{
$fid = intval($_GET['fid']);
if (empty($fid))
message($lang_common['Bad request']);
if ($permissions['users_post_topic'] == '0' && $cur_user['status'] < 1 || $permissions['guests_post_topic'] == '0' && $cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT moderators, admmod_only, closed FROM '.$db->prefix.'forums WHERE id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($moderators, $admmod_only, $forum_closed) = $db->fetch_row($result);
$mods_array = ($moderators != '') ? unserialize($moderators) : array();
if ($admmod_only == '1' && $cur_user['status'] < 1 || $forum_closed == '1' && $cur_user['status'] < 2 && !array_key_exists($cur_user['username'], $mods_array))
message($lang_common['No permission']);
$subject = trim(un_escape($_POST['req_subject']));
if ($subject == '')
message($lang_post['No subject']);
else if (strlen($subject) > 70)
message($lang_post['Too long subject']);
else if ($permissions['subject_all_caps'] == '0' && !preg_match("/[[:lower:]]/", $subject) && $cur_user['status'] < 1)
message($lang_post['No caps subject']);
}
else
message($lang_common['Bad request']);
// If the user is logged in we get the username and e-mail from $cur_user
if (!$cookie['is_guest'])
{
$username = $cur_user['username'];
$email = $cur_user['email'];
}
// Otherwise it should be in $_POST
else
{
$username = trim(un_escape($_POST['req_username']));
$email = trim($_POST['req_email']);
// Load the register.php/profile.php language files
require 'lang/'.$language.'/'.$language.'_prof_reg.php';
require 'lang/'.$language.'/'.$language.'_register.php';
// It's a guest, so we have to check the username
if (strlen($username) < 2)
message($lang_prof_reg['Username too short']);
else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
message($lang_prof_reg['Username guest']);
else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
message($lang_prof_reg['Username IP']);
else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
message($lang_prof_reg['Username BBCode']);
// Check username for any censored words
$temp = censor_words($username);
if (strcmp($temp, $username))
message($lang_register['Username censor']);
// Check that the username (or a too similar username) is not already registered
$result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.addslashes($username).'\' OR username=\''.addslashes(preg_replace("/[^\w]/", '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
$busy = $db->result($result, 0);
message($lang_register['Username dupe 1'].' '.htmlspecialchars($busy).'. '.$lang_register['Username dupe 2']);
}
require 'include/email.php';
if (!is_valid_email($email))
message($lang_common['Invalid e-mail']);
}
$message = trim(un_escape($_POST['req_message']));
// Make sure all newlines are \n and not \r\n or \r
$message = str_replace("\r", "\n", str_replace("\r\n", "\n", $message));
if ($message == '')
message($lang_post['No message']);
else if (strlen($message) > 65535)
message($lang_post['Too long message']);
else if ($permissions['message_all_caps'] == '0' && !preg_match("/[[:lower:]]/", $message) && $cur_user['status'] < 1)
message($lang_post['No caps message']);
// Validate BBCode syntax
if ($permissions['message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
{
// Change all BBCodes to lower case (this way a lot of regex searches can be case sensitive)
$a = array('[B]', '[I]', '[U]', '[/B]', '[/I]', '[/U]');
$b = array('[b]', '[i]', '[u]', '[/b]', '[/i]', '[/u]');
$message = str_replace($a, $b, $message);
$a = array("#\[quote\]#i", "#\[/quote\]#i", "#\[code\]#i", "#\[/code\]#i", "#\[colou?r=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\]#i", "#\[/colou?r\]#i", "#\[img\]#i", "#\[/img\]#i", "#\[email\]#i", "#\[email=#i", "#\[/email\]#i", "#\[url\]#i", "#\[url=#i", "#\[/url\]#i");
$b = array('[quote]', '[/quote]', '[code]', '[/code]', "[color=\\1]", '[/color]', '[img]', '[/img]', '[email]', '[email=', '[/email]', '[url]', '[url=', '[/url]');
$message = preg_replace($a, $b, $message);
require 'include/parser.php';
if ($overflow = check_tag_order($message))
// The quote depth level was too high, so we strip out the inner most quote(s)
$message = substr($message, 0, $overflow[0]).substr($message, $overflow[1], (strlen($message) - $overflow[0]));
}
if ($smilies != '1') $smilies = '0';
$now = time();
require 'include/searchidx.php';
// If it's a reply
if (isset($_GET['tid']))
{
// Get the topic and any subscribed users
$result = $db->query('SELECT subject, subscribers FROM '.$db->prefix.'topics WHERE id='.$tid) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
list($subject, $subscribers_save) = $db->fetch_row($result);
if (!$cookie['is_guest'])
{
// Insert the new post (start transaction)
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, smilies, posted, topic_id) VALUES(\''.addslashes($username).'\', '.$cur_user['id'].', \''.get_remote_address().'\', \''.addslashes($message).'\', \''.$smilies.'\', '.$now.', '.$tid.')', PUN_TRANS_START) or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();
if ($options['subscriptions'] == '1' && isset($_POST['subscribe']) == '1')
{
if ($subscribers_save == '')
$subscribers = $cur_user['email'];
else
{
if (!strstr($subscribers_save, $cur_user['email']))
$subscribers = $subscribers_save.','.$cur_user['email'];
else
$subscribers = $subscribers_save;
}
// Update topic
$db->query('UPDATE '.$db->prefix.'topics SET num_replies=num_replies+1, subscribers=\''.$subscribers.'\', last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.addslashes($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
}
else
// Update topic
$db->query('UPDATE '.$db->prefix.'topics SET num_replies=num_replies+1, last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.addslashes($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
}
else
{
// It's a guest. Insert the new post (start transaction)
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, smilies, posted, topic_id) VALUES(\''.addslashes($username).'\', \''.get_remote_address().'\', \''.$email.'\', \''.addslashes($message).'\', \''.$smilies.'\', '.$now.', '.$tid.')', PUN_TRANS_START) or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();
// Update topic
$db->query('UPDATE '.$db->prefix.'topics SET num_replies=num_replies+1, last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.addslashes($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
}
update_search_index('post', $new_pid, $message);
update_forum($forum_id, PUN_TRANS_END); // end transaction
// If there are any subscribed users and it's not the posting user him/herself
if ($subscribers_save != '' && $subscribers_save != isset($cur_user['email']))
{
$addresses = explode(',', $subscribers_save);
$addresses = array_map('trim', $addresses);
foreach ($addresses as $key => $value)
{
if ($value == isset($cur_user['email']))
unset($addresses[$key]); // Remove the user who is posting (no need to e-mail him/her)
}
$subscribers_save = implode(',', $addresses);
$mail_subject = $lang_post['Reply mail 1'].': '.$subject;
$mail_message = $username.' '.$lang_post['Reply mail 2'].' \''.$subject.'\' '.$lang_post['Reply mail 3']."\r\n\r\n".$lang_post['Reply mail 4'].' '.$options['base_url'].'/viewtopic.php?pid='.$new_pid.'#'.$new_pid."\r\n\r\n".$lang_post['Reply mail 5'].' '.$options['base_url'].'/misc.php?unsubscribe='.$tid."\r\n\r\n".'/Forum Mailer'."\r\n".'('.$lang_post['Reply mail 6'].')';
$mail_extra = 'From: '.$options['board_title'].' Mailer <'.$options['webmaster_email'].'>';
require_once 'include/email.php'; // It could've been included once already
pun_mail($subscribers_save, $mail_subject, $mail_message, $mail_extra);
}
}
// If it's a new topic
else if (isset($_GET['fid']))
{
if (!$cookie['is_guest'])
{
// Create the topic (start transaction)
if ($options['subscriptions'] == '1' && isset($_POST['subscribe']) == '1')
$db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, subscribers, forum_id) VALUES(\''.addslashes($username).'\', \''.addslashes($subject).'\', '.$now.', '.$now.', \''.addslashes($username).'\', \''.$email.'\', '.$fid.')', PUN_TRANS_START) or error('Unable to create topic', __FILE__, __LINE__, $db->error());
else
$db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\''.addslashes($username).'\', \''.addslashes($subject).'\', '.$now.', '.$now.', \''.addslashes($username).'\', '.$fid.')', PUN_TRANS_START) or error('Unable to create topic', __FILE__, __LINE__, $db->error());
$new_tid = $db->insert_id();
// Create the post ("topic post")
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, smilies, posted, topic_id) VALUES(\''.addslashes($username).'\', '.$cur_user['id'].', \''.get_remote_address().'\', \''.addslashes($message).'\', \''.$smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
}
else
{
// Create the topic (start transaction)
$db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\''.addslashes($username).'\', \''.addslashes($subject).'\', '.$now.', '.$now.', \''.addslashes($username).'\', '.$fid.')', PUN_TRANS_START) or error('Unable to create topic', __FILE__, __LINE__, $db->error());
$new_tid = $db->insert_id();
// Create the post ("topic post")
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, smilies, posted, topic_id) VALUES(\''.addslashes($username).'\', \''.get_remote_address().'\', \''.$email.'\', \''.addslashes($message).'\', \''.$smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
}
$new_pid = $db->insert_id();
// Update the topic with last_post_id
$db->query('UPDATE '.$db->prefix.'topics SET last_post_id='.$new_pid.' WHERE id='.$new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
update_search_index('post', $new_pid, $message, $subject);
update_forum($fid, PUN_TRANS_END); // end transaction
}
if (!$cookie['is_guest'])
$db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$cur_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
redirect('viewtopic.php?pid='.$new_pid.'#'.$new_pid, $lang_post['Post redirect']);
}
else
{
// If a topic id was specified in the url (it's a reply).
if (isset($_GET['tid']))
{
$tid = intval($_GET['tid']);
if (empty($tid))
message($lang_common['Bad request']);
if ($permissions['users_post'] == '0' && $cur_user['status'] < 1 || $permissions['guests_post'] == '0' && $cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT subject, closed, forum_id FROM '.$db->prefix.'topics WHERE id='.$tid) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($subject, $closed, $forum_id) = $db->fetch_row($result);
$forum_closed = '0';
if (!is_admmod($forum_id, $forum_closed, $admmod_only))
{
if ($admmod_only == '1' && $cur_user['status'] < 1 || $closed == '1' || $forum_closed == '1')
message($lang_common['No permission']);
}
$action = $lang_post['Post a reply'];
$form = '<form method="post" action="post.php?action=post&amp;tid='.$tid.'" id="post" onsubmit="return process_form(this)">';
// If a quoteid was specified in the url.
if (isset($_GET['qid']))
{
$qid = intval($_GET['qid']);
if (empty($qid))
message($lang_common['Bad request']);
$result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($qposter, $qmessage) = $db->fetch_row($result);
if ($permissions['message_bbcode'] == '1')
$quote = '[quote][b][i]'.$qposter.' '.$lang_post['wrote'].':[/i][/b]'."\n\n".$qmessage."\n".'[/quote]'."\n";
else
$quote = '> '.$qposter.' '.$lang_post['wrote'].':'."\n\n".'> '.$qmessage."\n";
}
// We have to fetch the forum name in order to display Title / Forum / Topic
$result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
$forum = '<a href="viewforum.php?id='.$forum_id.'">'.htmlspecialchars($db->result($result, 0)).'</a>';
}
// If a forum_id was specified in the url (new topic).
else if (isset($_GET['fid']))
{
$fid = intval($_GET['fid']);
if (empty($fid))
message($lang_common['Bad request']);
if ($permissions['users_post_topic'] == '0' && $cur_user['status'] < 1 || $permissions['guests_post_topic'] == '0' && $cookie['is_guest'])
message($lang_common['No permission']);
$result = $db->query('SELECT forum_name, moderators, admmod_only, closed FROM '.$db->prefix.'forums WHERE id='.$fid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($forum_name, $moderators, $admmod_only, $forum_closed) = $db->fetch_row($result);
$mods_array = ($moderators != '') ? unserialize($moderators) : array();
if ($admmod_only == '1' && $cur_user['status'] < 1 || $forum_closed == '1' && $cur_user['status'] < 2 && !array_key_exists($cur_user['username'], $mods_array))
message($lang_common['No permission']);
$action = $lang_post['Post new topic'];
$form = '<form method="post" action="post.php?action=post&amp;fid='.$fid.'" id="post" onsubmit="return process_form(this)">';
$forum = htmlspecialchars($forum_name);
}
else
message($lang_common['Bad request']);
$page_title = htmlspecialchars($options['board_title']).' / '.$action;
$validate_form = true;
$form_name = 'post';
$dimsubmit = true;
if (!$cookie['is_guest'])
{
if (isset($_GET['fid']))
$focus_element = 'req_subject';
else
$focus_element = 'req_message';
}
else
$focus_element = 'req_username';
require 'header.php';
$cur_index = 1;
?>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td><b><a href="index.php"><?php print htmlspecialchars($options['board_title']) ?></a> / <?php print $forum ?><?php if (isset($subject)) print ' / '.htmlspecialchars($subject) ?></b></td>
</tr>
</table>
<?php print $form."\n" ?>
<input type="hidden" name="form_sent" value="1">
<input type="hidden" name="form_user" value="<?php print (!$cookie['is_guest']) ? htmlspecialchars($cur_user['username']) : 'Guest'; ?>">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $action ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_common['Username'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<?php print (!$cookie['is_guest']) ? htmlspecialchars($cur_user['username']) : '<input type="text" name="req_username" size="25" maxlength="25" tabindex="'.($cur_index++).'">'; ?></td>
</tr>
<?php if ($cookie['is_guest']): ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_common['E-mail'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<input type="text" name="req_email" size="50" maxlength="50" tabindex="<?php print $cur_index++ ?>"></td>
</tr>
<?php endif; ?><?php if (isset($fid)): ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_post['Subject'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">&nbsp;<input type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php print $cur_index++ ?>"></td>
</tr>
<?php endif; ?> <tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">
<b><?php print $lang_common['Message'] ?></b>&nbsp;&nbsp;<br><br>
HTML: <?php print ($permissions['message_html'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">BBCode</a>: <?php print ($permissions['message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">[img] tag</a>: <?php print ($permissions['message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">Smilies</a>: <?php print ($options['smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;
</td>
<td class="puncon2">&nbsp;<textarea name="req_message" rows="20" cols="95" tabindex="<?php print $cur_index++ ?>"><?php if (isset($quote)) { print $quote; } ?></textarea></td>
</tr>
<?php
if (!$cookie['is_guest'])
{
if ($options['smilies'] == '1')
{
if ($cur_user['smilies'] == '1')
$checkboxes[] = '<input type="checkbox" name="smilies" value="1" tabindex="'.($cur_index++).'" checked>&nbsp;'.$lang_post['Show smilies'];
else
$checkboxes[] = '<input type="checkbox" name="smilies" value="1" tabindex="'.($cur_index++).'">&nbsp;'.$lang_post['Show smilies'];
}
if ($options['subscriptions'] == '1')
$checkboxes[] = '<input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'">&nbsp;'.$lang_post['Subscribe'];
if (isset($checkboxes))
$checkboxes = implode('<br>'."\n\t\t\t\t", $checkboxes)."\n";
}
else if ($options['smilies'] == '1')
$checkboxes = '<input type="checkbox" name="smilies" value="1" tabindex="'.($cur_index++).'" checked>&nbsp;'.$lang_post['Show smilies']."\n";
if (isset($checkboxes))
{
?>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Options'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">
<?php print $checkboxes ?>
</td>
</tr>
<?php
}
?>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2"><br>&nbsp;&nbsp;<input type="submit" name="submit" value="<?php print $lang_common['Submit'] ?>" tabindex="<?php print $cur_index++ ?>" accesskey="s">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)"><?php print $lang_common['Go back'] ?></a><br><br></td>
</tr>
</table>
</form>
<?php
// Check to see if the topic review is to be displayed.
if (isset($_GET['tid']) && $options['topic_review'] > 0)
{
require 'include/parser.php';
$result = $db->query('SELECT poster, message, smilies, posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY posted DESC LIMIT '.$options['topic_review']) or error('Unable to fetch topic review', __FILE__, __LINE__, $db->error());
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_post['Topic review'] ?></td>
</tr>
<?php
while ($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['smilies']);
?>
<tr>
<td class="puncon1" style="width: 140px; vertical-align: top"><?php print htmlspecialchars($cur_post['poster']) ?></td>
<td class="puncon2"><?php print $cur_post['message'] ?></td>
</tr>
<?php
}
print "</table>\n";
}
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

1187
profile.php Normal file

File diff suppressed because it is too large Load Diff

343
register.php Normal file
View File

@ -0,0 +1,343 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
// If we are logged in, we shouldn't be here
if (!$cookie['is_guest'])
header('Location: index.php');
// Load the register.php language file
require 'lang/'.$language.'/'.$language.'_register.php';
// Load the register.php/profile.php language file
require 'lang/'.$language.'/'.$language.'_prof_reg.php';
if ($options['regs_allow'] == '0')
message($lang_register['No new regs']);
// User pressed the cancel button
if (isset($_POST['cancel']))
redirect('index.php', $lang_register['Reg cancel redirect']);
else if ($options['rules'] == '1' && !isset($_POST['accept']) && !isset($_POST['form_sent']))
{
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_register['Register'];
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="register.php">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead"><?php print $lang_register['Forum rules'] ?></td>
</tr>
<tr>
<td class="puncon2">
<?php print $options['rules_message'] ?>
<br><br><br><div style="text-align: center"><input type="submit" name="accept" value="<?php print $lang_register['Accept'] ?>">&nbsp;&nbsp;<input type="submit" name="cancel" value="<?php print $lang_register['Cancel'] ?>"></div><br>
</td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}
else if (isset($_POST['form_sent']))
{
$username = trim(un_escape($_POST['req_username']));
$email1 = strtolower(trim($_POST['req_email1']));
if ($options['regs_validate'] == '1')
{
$email2 = strtolower(trim($_POST['req_email2']));
$password1 = random_pass(8);
$password2 = $password1;
}
else
{
$password1 = trim(un_escape($_POST['req_password1']));
$password2 = trim(un_escape($_POST['req_password2']));
}
// Validate username and passwords
if (strlen($username) < 2)
message($lang_prof_reg['Username too short']);
else if (strlen($password1) < 4)
message($lang_prof_reg['Pass too short']);
else if ($password1 != $password2)
message($lang_prof_reg['Pass not match']);
else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
message($lang_prof_reg['Username guest']);
else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
message($lang_prof_reg['Username IP']);
else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
message($lang_prof_reg['Username BBCode']);
// Check username for any censored words
if ($options['censoring'] == '1')
{
$temp = censor_words($username);
// If the censored username differs from the username
if (strcmp($temp, $username))
message($lang_register['Username censor']);
}
// Check that the username (or a too similar username) is not already registered
$result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.addslashes($username).'\' OR username=\''.addslashes(preg_replace("/[^\w]/", '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
$busy = $db->result($result, 0);
message($lang_register['Username dupe 1'].' '.htmlspecialchars($busy).'. '.$lang_register['Username dupe 2']);
}
// Validate e-mail
require 'include/email.php';
if (!is_valid_email($email1))
message($lang_common['Invalid e-mail']);
else if ($options['regs_validate'] == '1' && $email1 != $email2)
message($lang_register['E-mail not match']);
// Check it it's a banned e-mail address
if (is_banned_email($email1))
{
if ($permissions['allow_banned_email'] == '0')
message($lang_prof_reg['Banned e-mail']);
$banned_email = true; // Used later when we send an alert e-mail
}
// Check if someone else already has registered with that e-mail address
$result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$email1.'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
$num_dupes = $db->num_rows($result);
if ($num_dupes > 0 && $permissions['allow_dupe_email'] == '0')
message($lang_prof_reg['Dupe e-mail']);
$hide_email = (isset($_POST['hide_email']) != '1') ? '0' : '1';
$save_pass = (isset($_POST['save_pass']) != '1') ? '0' : '1';
// Insert the new user into the database. We have to do this now to get the last inserted id in order to
// send out an add an alert e-mail with a link to the users profile (phew!)
$now = time();
$intial_status = ($options['regs_validate'] == '0') ? 0 : -1;
// Add the user
$db->query('INSERT INTO '.$db->prefix.'users (username, password, email, hide_email, save_pass, timezone, style, status, registered) VALUES(\''.addslashes($username).'\', \''.md5($password1).'\', \''.$email1.'\', '.$hide_email.', '.$save_pass.', '.$_POST['timezone'].' ,\''.$options['default_style'].'\' ,'.$intial_status.', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
$new_uid = $db->insert_id();
// If we previously found out that the e-mail was banned
if (isset($banned_email) && $options['mailing_list'] != '')
{
$mail_subject = 'Alert - Banned e-mail detected';
$mail_message = 'User "'.$username.'" registered with banned e-mail address: '.$email1."\r\n\r\n".'User profile: '.$options['base_url'].'/profile.php?id='.$new_uid;
$mail_extra = 'From: '.$options['board_title'].' Mailer <'.$options['webmaster_email'].'>';
require 'include/email.php';
pun_mail($options['mailing_list'], $mail_subject, $mail_message, $mail_extra);
}
// If we previously found out that the e-mail was a dupe
if ($num_dupes && $options['mailing_list'] != '')
{
while ($cur_dupe = $db->fetch_assoc($result))
$dupe_list[] = $cur_dupe['username'];
$mail_subject = 'Alert - Duplicate e-mail detected';
$mail_message = 'User "'.$username.'" registered with an e-mail address that also belongs to: '.implode(', ', $dupe_list)."\r\n\r\n".'User profile: '.$options['base_url'].'/profile.php?id='.$new_uid;
$mail_extra = 'From: '.$options['board_title'].' Mailer <'.$options['webmaster_email'].'>';
require_once 'include/email.php';
pun_mail($options['mailing_list'], $mail_subject, $mail_message, $mail_extra);
}
// Must the user validate the registration or do we log him/her in right now?
if ($options['regs_validate'] == '1')
{
$mail_subject = $lang_register['Reg e-mail 1'];
$mail_message = $lang_register['Reg e-mail 2'].' '.$options['base_url'].'/'."\r\n\r\n".$lang_register['Reg e-mail 3'].': '.$username."\r\n".$lang_register['Reg e-mail 4'].': '.$password1."\r\n\r\n".$lang_register['Reg e-mail 5'].' '.$options['base_url'].'/login.php '.$lang_register['Reg e-mail 6']."\r\n\r\n".'/Forum Mailer'."\r\n".'('.$lang_register['Reg e-mail 7'].')';
$mail_extra = 'From: '.$options['board_title'].' Mailer <'.$options['webmaster_email'].'>';
pun_mail($email1, $mail_subject, $mail_message, $mail_extra);
message($lang_register['Reg e-mail 8'].' '.$email1.'. '.$lang_register['Reg e-mail 9'].' <a href="mailto:'.$options['admin_email'].'">'.$options['admin_email'].'</a>.', true);
}
else
{
$expire = ($save_pass != '0') ? $now + 31536000 : 0;
setcookie('punbb_cookie', serialize(array($username, md5($password1), $now, $now, $now)), $expire, $cookie_path, $cookie_domain, $cookie_secure);
}
redirect('index.php', $lang_register['Reg complete']);
}
else
{
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_register['Register'];
$validate_form = true;
$form_name = 'register';
$focus_element = 'req_username';
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead"><?php print $lang_common['Info'] ?></td>
</tr>
<tr>
<td class="puncon2">
<?php print $lang_register['Desc 1'] ?><br><br>
<?php print $lang_register['Desc 2'] ?>
</td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="register.php?action=register" id="register" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_register['Register'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_common['Username'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px"><?php print $lang_register['Username info'] ?></div><br>
&nbsp;<input type="text" name="req_username" size="25" maxlength="25">
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_prof_reg['Password'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<?php
if ($options['regs_validate'] == '1')
print "\t\t\t\t".'<div style="padding-left: 4px">'.$lang_register['Pass info 2'].'</div>'."\n";
else
{
?>
<div style="padding-left: 4px"><?php print $lang_register['Pass info 1'] ?></div><br>
&nbsp;<input type="password" name="req_password1" size="16" maxlength="16"><br>
&nbsp;<input type="password" name="req_password2" size="16" maxlength="16">&nbsp;&nbsp;<?php print $lang_prof_reg['Re-enter pass'] ?>
<?php
}
?>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_common['E-mail'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<?php
if ($options['regs_validate'] == '1')
print "\t\t\t\t".'<div style="padding-left: 4px">'.$lang_register['E-mail info 1'].'</div><br>'."\n\t\t\t\t".'&nbsp;<input type="text" name="req_email1" size="50" maxlength="50"><br>'."\n\n\t\t\t\t".'&nbsp;<input type="text" name="req_email2" size="50" maxlength="50">&nbsp;&nbsp;'.$lang_register['Re-enter e-mail'];
else
print "\t\t\t\t".'<div style="padding-left: 4px">'.$lang_register['E-mail info 2'].'</div><br>'."\n\t\t\t\t".'&nbsp;<input type="text" name="req_email1" size="50" maxlength="50">';
?>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_prof_reg['Timezone'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px"><?php print $lang_prof_reg['Timezone info'] ?></div><br>
&nbsp;<select name="timezone">
<option value="-12"<?php if ($options['server_timezone'] == -12 ) print ' selected' ?>>-12</option>
<option value="-11"<?php if ($options['server_timezone'] == -11) print ' selected' ?>>-11</option>
<option value="-10"<?php if ($options['server_timezone'] == -10) print ' selected' ?>>-10</option>
<option value="-9"<?php if ($options['server_timezone'] == -9 ) print ' selected' ?>>-09</option>
<option value="-8"<?php if ($options['server_timezone'] == -8 ) print ' selected' ?>>-08 PST</option>
<option value="-7"<?php if ($options['server_timezone'] == -7 ) print ' selected' ?>>-07 MST</option>
<option value="-6"<?php if ($options['server_timezone'] == -6 ) print ' selected' ?>>-06 CST</option>
<option value="-5"<?php if ($options['server_timezone'] == -5 ) print ' selected' ?>>-05 EST</option>
<option value="-4"<?php if ($options['server_timezone'] == -4 ) print ' selected' ?>>-04 AST</option>
<option value="-3"<?php if ($options['server_timezone'] == -3 ) print ' selected' ?>>-03 ADT</option>
<option value="-2"<?php if ($options['server_timezone'] == -2 ) print ' selected' ?>>-02</option>
<option value="-1"<?php if ($options['server_timezone'] == -1) print ' selected' ?>>-01</option>
<option value="0"<?php if ($options['server_timezone'] == 0) print ' selected' ?>>00 GMT</option>
<option value="1"<?php if ($options['server_timezone'] == 1) print ' selected' ?>>+01 CET</option>
<option value="2"<?php if ($options['server_timezone'] == 2 ) print ' selected' ?>>+02</option>
<option value="3"<?php if ($options['server_timezone'] == 3 ) print ' selected' ?>>+03</option>
<option value="4"<?php if ($options['server_timezone'] == 4 ) print ' selected' ?>>+04</option>
<option value="5"<?php if ($options['server_timezone'] == 5 ) print ' selected' ?>>+05</option>
<option value="6"<?php if ($options['server_timezone'] == 6 ) print ' selected' ?>>+06</option>
<option value="7"<?php if ($options['server_timezone'] == 7 ) print ' selected' ?>>+07</option>
<option value="8"<?php if ($options['server_timezone'] == 8 ) print ' selected' ?>>+08</option>
<option value="9"<?php if ($options['server_timezone'] == 9 ) print ' selected' ?>>+09</option>
<option value="10"<?php if ($options['server_timezone'] == 10) print ' selected' ?>>+10</option>
<option value="11"<?php if ($options['server_timezone'] == 11) print ' selected' ?>>+11</option>
<option value="12"<?php if ($options['server_timezone'] == 12 ) print ' selected' ?>>+12</option>
<option value="13"<?php if ($options['server_timezone'] == 13 ) print ' selected' ?>>+13</option>
</select>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Options'] ?>&nbsp;&nbsp;</td>
<td class="puncon2">
<div style="padding-left: 4px"><?php print $lang_prof_reg['Hide e-mail info'] ?></div>
<input type="checkbox" name="hide_email" value="1">&nbsp;<?php print $lang_prof_reg['Hide e-mail'] ?><br><br>
<div style="padding-left: 4px"><?php print $lang_prof_reg['Save user/pass info'] ?></div>
<input type="checkbox" name="save_pass" value="1" checked>&nbsp;<?php print $lang_prof_reg['Save user/pass'] ?>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2"><br>&nbsp;&nbsp;<input type="submit" name="register" value="<?php print $lang_common['Submit'] ?>">&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)"><?php print $lang_common['Go back'] ?></a><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';
}

719
search.php Normal file
View File

@ -0,0 +1,719 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// The contents of this file are very much inspired by the file search.php
// from the phpBB Group forum software phpBB2 (http://www.phpbb.com).
require 'config.php';
require 'include/common.php';
// Load the search.php language file
require 'lang/'.$language.'/'.$language.'_search.php';
if (!$cookie['is_guest'])
{
$disp_topics = $cur_user['disp_topics'];
$disp_posts = $cur_user['disp_posts'];
}
else
{
if ($permissions['guests_read'] == '0')
message($lang_common['Login required'].' <a href="login.php">'.$lang_common['Login'].'</a> '.$lang_common['or'].' <a href="register.php">'.$lang_common['register'].'</a>.');
else if ($permissions['guests_search'] == '0')
message($lang_search['No guest search']);
$disp_topics = $options['disp_topics_default'];
$disp_posts = $options['disp_posts_default'];
}
// Figure out what to do :-)
if (isset($_POST['action']) || isset($_GET['action']) || isset($_GET['search_id']))
{
$action = (isset($_POST['action'])) ? $_POST['action'] : ((isset($_GET['action'])) ? $_GET['action'] : null);
$forum = (isset($_POST['forum'])) ? intval($_POST['forum']) : -1;
$sort_dir = (isset($_POST['sort_dir'])) ? (($_POST['sort_dir'] == 'DESC') ? 'DESC' : 'ASC') : 'DESC';
// If a search_id was supplied
if (isset($_GET['search_id']))
{
$search_id = intval($_GET['search_id']);
if (empty($search_id) || $search_id < 0)
message($lang_common['Bad request']);
}
// If it's a regular search (keywords and/or author)
else if ($action == 'search')
{
$keywords = (isset($_POST['keywords'])) ? trim($_POST['keywords']) : ((isset($_GET['keywords'])) ? trim($_GET['keywords']) : null);
$author = (isset($_POST['author'])) ? trim($_POST['author']) : ((isset($_GET['author'])) ? trim($_GET['author']) : null);
if ((!$keywords && !$author))
message($lang_search['No terms']);
if ($author)
$author = str_replace('*', '%', $author);
$show_as = (isset($_POST['show_as'])) ? $_POST['show_as'] : ((isset($_GET['show_as'])) ? $_GET['show_as'] : 'posts');
$sort_by = (isset($_POST['sort_by'])) ? intval($_POST['sort_by']) : null;
$search_in = (!isset($_POST['search_in']) || $_POST['search_in'] == 'all') ? 0 : (($_POST['search_in'] == 'message') ? 1 : -1);
}
// If it's a user search (by id)
else if ($action == 'show_user')
{
$user_id = intval($_GET['user_id']);
if ($user_id < 2)
message($lang_common['Bad request']);
}
else
{
if ($action != 'show_new' && $action != 'show_unanswered')
message($lang_common['Bad request']);
}
// Fetch the list of forums
$result = $db->query('SELECT id, forum_name, admmod_only FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
$num_forums = $db->num_rows($result);
// Build two arrays with foruminfo
$admmod_forums = array();
for ($i = 0; $i < $num_forums; $i++)
{
$forum_list[$i] = $db->fetch_row($result);
if ($forum_list[$i][2] == '1')
$admmod_forums[$i] = $forum_list[$i][0]; // $admmod_forums contains the ID's of admin/mod only forums
}
// If a valid search_id was supplied we attempt to fetch the search results from the db
if (isset($search_id))
{
if ($cookie['is_guest'])
$ident = get_remote_address();
else
$ident = addslashes($cookie['username']);
$result = $db->query('SELECT search_data FROM '.$db->prefix.'search_results WHERE id='.$search_id.' AND ident=\''.$ident.'\'') or error('Unable to fetch search results', __FILE__, __LINE__, $db->error());
if ($row = $db->fetch_assoc($result))
{
$temp = unserialize($row['search_data']);
$search_results = $temp['search_results'];
$num_hits = $temp['num_hits'];
$sort_by = $temp['sort_by'];
$sort_dir = $temp['sort_dir'];
$show_as = $temp['show_as'];
unset($temp);
}
else
message($lang_search['No hits']);
}
else
{
$keyword_results = $author_results = array();
// Search a specific forum?
if ($forum != -1)
{
if (in_array($forum, $admmod_forums) && $cur_user['status'] < 1)
message($lang_search['No hits']);
$forum_sql = 't.forum_id = '.$forum;
}
else
{
if (empty($admmod_forums) || $cur_user['status'] > 0)
$forum_sql = '';
else
$forum_sql = 't.forum_id NOT IN('.implode(',', $admmod_forums).')';
}
if (isset($author) || isset($keywords))
{
// If it's a search for keywords
if ($keywords)
{
$stopwords = @file('lang/'.$language.'/'.$language.'_stopwords.txt');
$keywords = ' '.strtolower($keywords).' ';
// Locate some common search operators
$operator_match = array('+', '-', '&&', '||');
$operator_replace = array(' and ', ' not ', ' and ', ' or ');
$keywords = str_replace($operator_match, $operator_replace, $keywords);
// Filter out non-alphabetical chars
$noise_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '~', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!', '<27>');
$noise_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '' , ' ', ' ', ' ', ' ', ' ', ' ', ' ');
$keywords = str_replace($noise_match, $noise_replace, $keywords);
// Filter out stopwords
if (!empty($stopwords))
{
foreach ($stopwords as $word)
{
$word = trim($word);
if ($word != 'and' || $word != 'or' || $word != 'not')
$text = preg_replace('#\b'.preg_quote($word).'\b#', ' ', isset($text));
}
}
// Split up keywords
$keywords_array = preg_split('#[\s]+#', substr($keywords, 1, -1));
// Should we search in message body or topic subject specifically?
if ($search_in)
$search_in_cond = ($search_in > 0) ? 'AND m.subject_match = 0' : 'AND m.subject_match = 1';
$match_type = 'or';
foreach ($keywords_array as $cur_word)
{
switch ($cur_word)
{
case 'and':
case 'or':
case 'not':
$match_type = $cur_word;
break;
default:
{
$match_word = str_replace('*', '%', $cur_word);
$sql = 'SELECT m.post_id FROM '.$db->prefix.'search_words AS w INNER JOIN '.$db->prefix.'search_matches AS m ON m.word_id = w.id WHERE w.word LIKE \''.$match_word.'\''.isset($search_in_cond);
$result = $db->query($sql) or error('Unable to search for posts', __FILE__, __LINE__, $db->error());
$row = array();
$result_list = null;
while ($temp = $db->fetch_row($result))
{
$row[$temp[0]] = 1;
if (!isset($word_count))
$result_list[$temp[0]] = 1;
else if ( $match_type == 'or')
$result_list[$temp[0]] = 1;
else if ( $match_type == 'not')
$result_list[$temp[0]] = 0;
}
if ($match_type === 'and' && $word_count > 0) {
foreach ($result_list as $post_id => $value) {
if (empty($row[$post_id])) {
$result_list[$post_id] = 0;
}
}
}
$word_count = 0;
$word_count++;
$db->free_result($result);
break;
}
}
}
if ($result_list !== null) {
@reset($result_list);
foreach ($result_list as $post_id => $matches) {
if ($matches) {
$keyword_results[] = $post_id;
}
}
unset($result_list);
}
}
// If it's a search for author name (and that author name isn't Guest)
if ($author && strcasecmp($author, 'Guest') && strcasecmp($author, $lang_common['Guest']))
{
switch ($db_type)
{
case 'mysql':
$result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE username LIKE \''.escape($author).'\'') or error('Unable to fetch users', __FILE__, __LINE__, $db->error());
break;
case 'pgsql':
$result = $db->query('SELECT id FROM '.$db->prefix.'users WHERE username ILIKE \''.escape($author).'\'') or error('Unable to fetch users', __FILE__, __LINE__, $db->error());
break;
}
if ($db->num_rows($result))
{
while ($row = $db->fetch_row($result))
$user_ids .= ( ($user_ids != '') ? ',' : '').$row[0];
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE poster_id IN('.$user_ids.')') or error('Unable to fetch matched posts list', __FILE__, __LINE__, $db->error());
$search_ids = array();
while ($row = $db->fetch_row($result))
$author_results[] = $row[0];
$db->free_result($result);
}
}
if ($author && $keywords)
{
// If we searched for both keywords and author name we want the intersection between the results
$search_ids = array_intersect($keyword_results, $author_results);
unset($keyword_results, $author_results);
}
else if ($keywords)
$search_ids = $keyword_results;
else
$search_ids = $author_results;
$num_hits = count($search_ids);
if (!$num_hits)
message($lang_search['No hits']);
if ($show_as == 'topics')
{
if ($forum_sql == '')
$sql = 'SELECT topic_id FROM '.$db->prefix.'posts WHERE id IN('.implode(',', $search_ids).') GROUP BY topic_id';
else
$sql = 'SELECT p.topic_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id WHERE p.id IN('.implode(',', $search_ids).') AND '.$forum_sql.' GROUP BY p.topic_id';
$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$search_ids = array();
while ($row = $db->fetch_row($result))
$search_ids[] = $row[0];
$db->free_result($result);
$num_hits = count($search_ids);
}
else if ($forum_sql)
{
$sql = 'SELECT p.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id WHERE p.id IN('.implode(',', $search_ids).') AND '.$forum_sql;
$result = $db->query($sql) or error('Unable to fetch post list', __FILE__, __LINE__, $db->error());
$search_ids = array();
while ($row = $db->fetch_row($result))
$search_ids[] = $row[0];
$db->free_result($result);
$num_hits = count($search_ids);
}
}
else if ($action == 'show_new' || $action == 'show_user' || $action == 'show_unanswered')
{
// If it's a search for new posts
if ($action == 'show_new')
{
if ($cookie['is_guest'])
message($lang_common['No permission']);
if ($forum_sql != '')
$sql = 'SELECT t.id FROM '.$db->prefix.'topics AS t WHERE t.last_post>'.$cookie['last_timeout'].' AND '.$forum_sql;
else
$sql = 'SELECT id FROM '.$db->prefix.'topics WHERE last_post>'.$cookie['last_timeout'];
$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No new posts']);
}
// If it's a search for posts by a specific user ID
else if ($action == 'show_user')
{
if ($forum_sql != '')
$sql = 'SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id WHERE p.poster_id='.$user_id.' AND '.$forum_sql.' GROUP BY t.id';
else
$sql = 'SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id WHERE p.poster_id='.$user_id.' GROUP BY t.id';
$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['User no posts']);
}
// If it's a search for unanswered posts
else
{
if ($forum_sql != '')
$sql = 'SELECT t.id FROM '.$db->prefix.'topics AS t WHERE t.num_replies=0 AND t.moved_to IS NULL AND '.$forum_sql;
else
$sql = 'SELECT id FROM '.$db->prefix.'topics WHERE num_replies=0 AND moved_to IS NULL';
$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No unanswered']);
}
// We want to sort things after last post
$sort_by = 4;
$search_ids = array();
while ($row = $db->fetch_row($result))
$search_ids[] = $row[0];
$db->free_result($result);
$show_as = 'topics';
}
else
message($lang_common['Bad request']);
// Prune "old" search results
$result = $db->query('SELECT ident FROM '.$db->prefix.'online') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result) > 0)
{
while ($row = $db->fetch_row($result))
$old_searches[] = '\''.$row[0].'\'';
$db->query('DELETE FROM '.$db->prefix.'search_results WHERE ident NOT IN('.implode(',', $old_searches).')') or error('Unable to delete search results', __FILE__, __LINE__, $db->error());
}
// Final search results
$search_results = implode(',', $search_ids);
// Fill an array with our results and search properties
$temp['search_results'] = $search_results;
$temp['num_hits'] = $num_hits;
$temp['sort_by'] = $sort_by;
$temp['sort_dir'] = $sort_dir;
$temp['show_as'] = $show_as;
$temp = addslashes(serialize($temp));
$search_id = mt_rand();
if ($cookie['is_guest'])
$ident = get_remote_address();
else
$ident = addslashes($cookie['username']);
$db->query('UPDATE '.$db->prefix.'search_results SET id='.$search_id.', search_data=\''.$temp.'\' WHERE ident=\''.$ident.'\'') or error('Unable to update search results', __FILE__, __LINE__, $db->error());
if (!$db->affected_rows())
$db->query('INSERT INTO '.$db->prefix.'search_results (id, ident, search_data) VALUES('.$search_id.', \''.$ident.'\', \''.$temp.'\')') or error('Unable to insert search results', __FILE__, __LINE__, $db->error());
}
// Fetch results to display
if ($search_results != '')
{
switch ($sort_by)
{
case 1:
$sql = ($show_as == 'topics') ? 't.poster' : 'p.poster';
break;
case 2:
$sql = 't.subject';
break;
case 3:
$sql = 't.forum_id';
break;
case 4:
$sql = 't.last_post';
break;
default:
{
$sql = ($show_as == 'topics') ? 't.posted' : 'p.posted';
if ($show_as == 'topics')
$group_by = ', t.posted';
break;
}
}
$group_by = '';
if ($show_as == 'posts')
$sql = 'SELECT p.id AS pid, p.poster AS pposter, p.poster_id, SUBSTRING(p.message, 1, 140) AS message, t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id WHERE p.id IN('.$search_results.') ORDER BY '.$sql;
else
$sql = 'SELECT t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id WHERE t.id IN('.$search_results.') GROUP BY t.id, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id'.$group_by.' ORDER BY '.$sql;
$per_page = ($show_as == 'posts') ? $disp_posts : $disp_topics;
// The number of pages required to display all results (depending on $disp_topics setting)
$num_pages = ceil($num_hits / $per_page);
if (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages)
{
$p = 1;
$start_from = 0;
}
else
{
$p = $_GET['p'];
$start_from = $per_page * ($p - 1);
}
$sql .= ' '.$sort_dir.' LIMIT '.$start_from.', '.$per_page;
$result = $db->query($sql) or error('Unable to fetch search results', __FILE__, __LINE__, $db->error());
$search_set = array();
while ($row = $db->fetch_assoc($result))
$search_set[] = $row;
$db->free_result($result);
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_search['Search results'];
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 24px">&nbsp;</td>
<td class="punhead" style="white-space: nowrap"><?php print ($show_as == 'posts') ? $lang_search['Topic/Message'] : $lang_common['Topic']; ?></td>
<td class="punhead" style="width: 18%; white-space: nowrap"><?php print $lang_common['Forum'] ?></td>
<td class="punhead" style="width: 11%; white-space: nowrap"><?php print $lang_common['Author'] ?></td>
<td class="punheadcent" style="width: 7%; white-space: nowrap"><?php print $lang_common['Replies'] ?></td>
<td class="punhead" style="width: 25%; white-space: nowrap"><?php print $lang_common['Last post'] ?></td>
</tr>
<?php
//here is the problem
for ($i = 0; $i < count($search_set); $i++)
{
@reset($forum_list);
foreach ($forum_list as $temp)
{
if ($temp[0] == $search_set[$i]['forum_id'])
$forum = '<a href="viewforum.php?id='.$temp[0].'">'.$temp[1].'</a>';
}
if ($options['censoring'] == '1')
$search_set[$i]['subject'] = censor_words($search_set[$i]['subject']);
$subject = '<a href="viewtopic.php?id='.$search_set[$i]['tid'].'">'.htmlspecialchars($search_set[$i]['subject']).'</a>';
if (!$cookie['is_guest'] && $search_set[$i]['last_post'] > $cookie['last_timeout'])
{
if ($cur_user['show_img'] != '0')
$icon = '<img src="img/'.$cur_user['style'].'_new.png" width="16" height="16" alt="">';
else
$icon = '<span class="puntext"><b>&#8226;</b></span>';
$subject = '<b>'.$subject.'</b>';
}
else
$icon = '&nbsp;';
if ($show_as == 'posts')
{
if ($options['censoring'] == '1')
$search_set[$i]['message'] = censor_words($search_set[$i]['message']);
$message = str_replace("\n", '<br>', htmlspecialchars($search_set[$i]['message']));
$pposter = htmlspecialchars($search_set[$i]['pposter']);
if ($search_set[$i]['poster_id'] > 1)
$pposter = '<a href="profile.php?id='.$search_set[$i]['poster_id'].'">'.$pposter.'</a>';
if (strlen($message) == 140)
$message .= ' ...';
?>
<tr class="puntopic">
<td class="puncon1cent"><?php print $icon ?></td>
<td class="puncon2">
<?php print $lang_common['Topic'] ?>: <?php print $subject ?><br>
<?php print $lang_common['Author'] ?>: <?php print $pposter ?><br><br>
<table class="punplain" style="table-layout: fixed" cellspacing="4" cellpadding="6">
<tr>
<td class="punquote">
<?php print $message ?>
<div style="text-align: right"><a href="viewtopic.php?pid=<?php print $search_set[$i]['pid'].'#'.$search_set[$i]['pid'] ?>"><?php print $lang_search['Go to post'] ?></a></div>
</td>
</tr>
</table>
</td>
<td class="puncon1"><?php print $forum ?></td>
<td class="puncon2"><?php print htmlspecialchars($search_set[$i]['poster']) ?></td>
<td class="puncon1cent"><?php print $search_set[$i]['num_replies'] ?></td>
<td class="puncon2" style="white-space: nowrap"><?php print '<a href="viewtopic.php?pid='.$search_set[$i]['last_post_id'].'#'.$search_set[$i]['last_post_id'].'">'.format_time($search_set[$i]['last_post']).'</a> '.$lang_common['by'].' '.htmlspecialchars($search_set[$i]['last_poster']) ?></td>
</tr>
<?php
}
else
{
?>
<tr class="puntopic">
<td class="puncon1cent"><?php print $icon ?></td>
<td class="puncon2"><?php print $subject ?></td>
<td class="puncon1"><?php print $forum ?></td>
<td class="puncon2"><?php print htmlspecialchars($search_set[$i]['poster']) ?></td>
<td class="puncon1cent"><?php print $search_set[$i]['num_replies'] ?></td>
<td class="puncon2" style="white-space: nowrap"><?php print '<a href="viewtopic.php?pid='.$search_set[$i]['last_post_id'].'#'.$search_set[$i]['last_post_id'].'">'.format_time( $search_set[$i]['last_post']).'</a> '.$lang_common['by'].' '.htmlspecialchars($search_set[$i]['last_poster']) ?></td>
</tr>
<?php
}
}
?>
</table>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td><?php print $lang_common['Pages'].': '.paginate($num_pages, $p, 'search.php?search_id='.$search_id) ?></td>
</tr>
</table>
<?php
$footer_style = 'search';
require 'footer.php';
}
else
message($lang_search['No hits']);
}
if ($options['search'] == '0' && $cur_user['status'] < 1)
message($lang_search['Search disabled']);
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_search['Search'];
$validate_form = true;
$form_name = 'search';
$focus_element = 'keywords';
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<form method="post" action="search.php?action=search" id="search" onsubmit="return process_form(this)">
<input type="hidden" name="action" value="search">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_search['Search'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_search['Keyword search'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<?php print $lang_search['Keyword search info'] ?><br><br>
&nbsp;<input type="text" name="keywords" size="40" maxlength="100">
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_search['Author search'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<?php print $lang_search['Author search info'] ?><br><br>
&nbsp;<input type="text" name="author" size="40" maxlength="100">
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_search['Forum search'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<br>&nbsp;
<select name="forum">
<?php
if ($options['search_all_forums'] == '1' || $cur_user['status'] > 0)
print "\t\t\t\t\t".'<option value="-1">'.$lang_search['All forums'].'</option>'."\n";
if ($cur_user['status'] < 1)
$extra = ' WHERE c.admmod_only=\'0\' AND f.admmod_only=\'0\'';
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra.' ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
$num_forums = $db->num_rows($result);
while ($num_forums--)
{
$forum = $db->fetch_assoc($result);
if ($forum['cid'] != $cur_category) // Are we still in the same category?
{
if (!empty($cur_category))
print "\t\t\t\t\t".'</optgroup>'."\n";
print "\t\t\t\t\t".'<optgroup label="'.htmlspecialchars($forum['cat_name']).'">'."\n";
$cur_category = $forum['cid'];
}
print "\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.htmlspecialchars($forum['forum_name']).'</option>'."\n";
}
?>
</optgroup>
</select><br><br>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_search['Search in'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
&nbsp;&nbsp;<input type="radio" name="search_in" value="all" checked>&nbsp;<?php print $lang_search['Message and subject'] ?><br>
&nbsp;&nbsp;<input type="radio" name="search_in" value="message">&nbsp;<?php print $lang_search['Message only'] ?><br>
&nbsp;&nbsp;<input type="radio" name="search_in" value="topic">&nbsp;<?php print $lang_search['Topic only'] ?>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_search['Sort by'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
<br>&nbsp;
<select name="sort_by">
<option value="0"><?php print $lang_search['Sort by post time'] ?></option>
<option value="1"><?php print $lang_search['Sort by author'] ?></option>
<option value="2"><?php print $lang_search['Sort by subject'] ?></option>
<option value="3"><?php print $lang_search['Sort by forum'] ?></option>
</select>
&nbsp;&nbsp;<input type="radio" name="sort_dir" value="ASC">&nbsp;<?php print $lang_search['Ascending'] ?>
&nbsp;&nbsp;<input type="radio" name="sort_dir" value="DESC" checked>&nbsp;<?php print $lang_search['Descending'] ?><br><br>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php print $lang_search['Show as'] ?></b>&nbsp;&nbsp;</td>
<td class="puncon2">
&nbsp;&nbsp;<input type="radio" name="show_as" value="topics" checked>&nbsp;<?php print $lang_search['Show as topics'] ?><br>
&nbsp;&nbsp;<input type="radio" name="show_as" value="posts">&nbsp;<?php print $lang_search['Show as posts'] ?>
</td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2"><br>&nbsp;&nbsp;<input type="submit" name="search" value="<?php print $lang_common['Submit'] ?>" accesskey="s"><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
require 'footer.php';

101
style/Cobalt.css Normal file
View File

@ -0,0 +1,101 @@
BODY { background-color: #2A2A2A }
TD {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8
}
INPUT, SELECT {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8;
background-color: #424242
}
TEXTAREA {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8;
background-color: #383838
}
FORM { margin: 0 }
PRE {
font-size: 11px;
margin: 0
}
TABLE.punplain {
border: none;
width: 100%
}
TABLE.punmain {
border: none;
width: 100%;
background-color: #606060
}
TR.punhead { background-color: #606060 }
TR.puncon1 { background-color: #383838 }
TR.puncon2 { background-color: #424242 }
TR.puncon3 { background-color: #484848 }
TR.puntopic { height: 1.5em }
TD.punhead { color: #F0F0F0 }
TD.punheadcent {
color: #F0F0F0;
text-align: center
}
TD.puncon1 { background-color: #383838 }
TD.puncon1cent {
background-color: #383838;
text-align: center
}
TD.puncon1right {
background-color: #383838;
text-align: right
}
TD.puncon2 { background-color: #424242 }
TD.puncon2cent {
background-color: #424242;
text-align: center
}
TD.puncon3 { background-color: #484848 }
TD.puncent { text-align: center }
TD.punright { text-align: right }
TD.puntop { vertical-align: top }
TD.puntopright {
text-align: right;
vertical-align: top
}
TD.punquote {
background-color: #484848;
border: #606060;
border-style: dashed;
border-width: 1px
}
A:link, A:visited {
text-decoration: none;
color: #60A0DC
}
A:link.punhot, A:visited.punhot { color: #FF4000 }
A:link.punclosed, A:visited.punclosed { color: #888888 }
A:hover {
text-decoration: none;
color: #80D6FF
}
A:hover.punhot { color: #FF5010 }
A:hover.punclosed { color: #AAAAAA }
IMG.punavatar {
margin-top: 3px;
margin-bottom: 3px
}
.puntext { font-size: 11px }
.punsignature { font-size: 10px }
.punheadline {
font-size: 12px;
font-weight: bold;
}
.punhot { color: #FF6000 }

99
style/Lithium.css Normal file
View File

@ -0,0 +1,99 @@
BODY { background-color: #FFFFFF }
TD {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
INPUT, SELECT {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
TEXTAREA {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
FORM { margin: 0 }
PRE {
font-size: 11px;
margin: 0
}
TABLE.punplain {
border: none;
width: 100%
}
TABLE.punmain {
border: none;
width: 100%;
background-color: #606060
}
TR.punhead { background-color: #9AC55A }
TR.puncon1 { background-color: #DEDFDF }
TR.puncon2 { background-color: #EEEEEE }
TR.puncon3 { background-color: #C0C0C0 }
TR.puntopic { height: 1.5em }
TD.punhead { color: #FFFFFF }
TD.punheadcent {
color: #FFFFFF;
text-align: center
}
TD.puncon1 { background-color: #DEDFDF }
TD.puncon1cent {
background-color: #DEDFDF;
text-align: center
}
TD.puncon1right {
background-color: #DEDFDF;
text-align: right
}
TD.puncon2 { background-color: #EEEEEE }
TD.puncon2cent {
background-color: #EEEEEE;
text-align: center
}
TD.puncon3 { background-color: #C8C8C8 }
TD.puncent { text-align: center }
TD.punright { text-align: right }
TD.puntop { vertical-align: top }
TD.puntopright {
text-align: right;
vertical-align: top
}
TD.punquote {
background-color: #F6F6F6;
border: #606060;
border-style: dashed;
border-width: 1px
}
A:link, A:visited {
text-decoration: none;
color: #415720
}
A:link.punhot, A:visited.punhot { color: #C03000 }
A:link.punclosed, A:visited.punclosed { color: #888888 }
A:hover {
text-decoration: none;
color: #709735
}
A:hover.punhot { color: #F43E00 }
A:hover.punclosed { color: #AAAAAA }
IMG.punavatar {
margin-top: 3px;
margin-bottom: 3px
}
.puntext { font-size: 11px }
.punsignature { font-size: 10px }
.punheadline {
font-size: 12px;
font-weight: bold;
}
.punhot { color: #C03000 }

102
style/Mercury.css Normal file
View File

@ -0,0 +1,102 @@
BODY { background-color: #2A2A2A }
TD {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8
}
INPUT, SELECT {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8;
background-color: #424242
}
TEXTAREA {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8;
background-color: #383838
}
FORM { margin: 0 }
PRE {
font-size: 11px;
margin: 0
}
TABLE.punplain {
border: none;
width: 100%
}
TABLE.punmain {
border: none;
width: 100%;
background-color: #606060
}
TR.punhead { background-color: #606060 }
TR.puncon1 { background-color: #383838 }
TR.puncon2 { background-color: #424242 }
TR.puncon3 { background-color: #484848 }
TR.puntopic { height: 1.5em }
TD.punhead { color: #F0F0F0 }
TD.punheadcent {
color: #F0F0F0;
text-align: center
}
TD.puncon1 { background-color: #383838 }
TD.puncon1cent {
background-color: #383838;
text-align: center
}
TD.puncon1right {
background-color: #383838;
text-align: right
}
TD.puncon2 { background-color: #424242 }
TD.puncon2cent {
background-color: #424242;
text-align: center
}
TD.puncon3 { background-color: #484848 }
TD.puncent { text-align: center }
TD.punright { text-align: right }
TD.puntop { vertical-align: top }
TD.puntopright {
text-align: right;
vertical-align: top
}
TD.punquote {
background-color: #484848;
border: #606060;
border-style: dashed;
border-width: 1px
}
A:link, A:visited {
text-decoration: none;
color: #F6B620
}
A:link.punhot, A:visited.punhot { color: #FF4000 }
A:link.punclosed, A:visited.punclosed { color: #888888 }
A:hover {
text-decoration: none;
color: #FFEE40
}
A:hover.punhot { color: #FF5010 }
A:hover.punclosed { color: #AAAAAA }
IMG.punavatar {
margin-top: 3px;
margin-bottom: 3px
}
.puntext { font-size: 11px }
.punsignature { font-size: 10px }
.punheadline {
font-size: 12px;
font-weight: bold;
}
.punhot { color: #FF6000 }

100
style/Oxygen.css Normal file
View File

@ -0,0 +1,100 @@
BODY { background-color: #FFFFFF }
TD {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
INPUT, SELECT {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
TEXTAREA {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
FORM { margin: 0 }
PRE {
font-size: 11px;
margin: 0
}
TABLE.punmain {
border: none;
background-color: #606060;
width: 100%;
}
TABLE.punplain {
border: none;
width: 100%
}
TR.punhead { background-color: #AAC9EB }
TR.puncon1 { background-color: #DEDFDF }
TR.puncon2 { background-color: #EEEEEE }
TR.puncon3 { background-color: #C0C0C0 }
TR.puntopic { height: 1.5em }
TD.punhead { color: #102945 }
TD.punheadcent {
color: #102945;
text-align: center
}
TD.puncon1 { background-color: #DEDFDF }
TD.puncon1cent {
background-color: #DEDFDF;
text-align: center
}
TD.puncon1right {
background-color: #DEDFDF;
text-align: right
}
TD.puncon2 { background-color: #EEEEEE }
TD.puncon2cent {
background-color: #EEEEEE;
text-align: center
}
TD.puncon3 { background-color: #C8C8C8 }
TD.puncent { text-align: center }
TD.punright { text-align: right }
TD.puntop { vertical-align: top }
TD.puntopright {
text-align: right;
vertical-align: top
}
TD.punquote {
background-color: #F6F6F6;
border: #606060;
border-style: dashed;
border-width: 1px
}
A:link, A:visited {
text-decoration: none;
color: #005CB1
}
A:link.punhot, A:visited.punhot { color: #C03000 }
A:link.punclosed, A:visited.punclosed { color: #888888 }
A:hover {
text-decoration: none;
color: #0099DD
}
A:hover.punhot { color: #F43E00 }
A:hover.punclosed { color: #AAAAAA }
IMG.punavatar {
margin-top: 3px;
margin-bottom: 3px
}
.puntext { font-size: 11px }
.punsignature { font-size: 10px }
.punheadline {
font-size: 12px;
font-weight: bold;
}
.punhot { color: #C03000 }

101
style/Radium.css Normal file
View File

@ -0,0 +1,101 @@
BODY { background-color: #2A2A2A }
TD {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8
}
INPUT, SELECT {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8;
background-color: #424242
}
TEXTAREA {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #D4D0C8;
background-color: #383838
}
FORM { margin: 0 }
PRE {
font-size: 11px;
margin: 0
}
TABLE.punplain {
border: none;
width: 100%
}
TABLE.punmain {
border: none;
width: 100%;
background-color: #606060
}
TR.punhead { background-color: #606060 }
TR.puncon1 { background-color: #383838 }
TR.puncon2 { background-color: #424242 }
TR.puncon3 { background-color: #484848 }
TR.puntopic { height: 1.5em }
TD.punhead { color: #F0F0F0 }
TD.punheadcent {
color: #F0F0F0;
text-align: center
}
TD.puncon1 { background-color: #383838 }
TD.puncon1cent {
background-color: #383838;
text-align: center
}
TD.puncon1right {
background-color: #383838;
text-align: right
}
TD.puncon2 { background-color: #424242 }
TD.puncon2cent {
background-color: #424242;
text-align: center
}
TD.puncon3 { background-color: #484848 }
TD.puncent { text-align: center }
TD.punright { text-align: right }
TD.puntop { vertical-align: top }
TD.puntopright {
text-align: right;
vertical-align: top
}
TD.punquote {
background-color: #484848;
border: #606060;
border-style: dashed;
border-width: 1px
}
A:link, A:visited {
text-decoration: none;
color: #60C860
}
A:link.punhot, A:visited.punhot { color: #FF4000 }
A:link.punclosed, A:visited.punclosed { color: #888888 }
A:hover {
text-decoration: none;
color: #80EE80
}
A:hover.punhot { color: #FF5010 }
A:hover.punclosed { color: #AAAAAA }
IMG.punavatar {
margin-top: 3px;
margin-bottom: 3px
}
.puntext { font-size: 11px }
.punsignature { font-size: 10px }
.punheadline {
font-size: 12px;
font-weight: bold;
}
.punhot { color: #FF6000 }

99
style/Sulfur.css Normal file
View File

@ -0,0 +1,99 @@
BODY { background-color: #FFFFFF }
TD {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
INPUT, SELECT {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
TEXTAREA {
font: 10px Verdana, Arial, Helvetica, sans-serif;
color: #333333
}
FORM { margin: 0 }
PRE {
font-size: 11px;
margin: 0
}
TABLE.punplain {
border: none;
width: 100%
}
TABLE.punmain {
border: none;
width: 100%;
background-color: #606060
}
TR.punhead { background-color: #D25028 }
TR.puncon1 { background-color: #DEDFDF }
TR.puncon2 { background-color: #EEEEEE }
TR.puncon3 { background-color: #C0C0C0 }
TR.puntopic { height: 1.5em }
TD.punhead { color: #FFFFFF }
TD.punheadcent {
color: #FFFFFF;
text-align: center
}
TD.puncon1 { background-color: #DEDFDF }
TD.puncon1cent {
background-color: #DEDFDF;
text-align: center
}
TD.puncon1right {
background-color: #DEDFDF;
text-align: right
}
TD.puncon2 { background-color: #EEEEEE }
TD.puncon2cent {
background-color: #EEEEEE;
text-align: center
}
TD.puncon3 { background-color: #C8C8C8 }
TD.puncent { text-align: center }
TD.punright { text-align: right }
TD.puntop { vertical-align: top }
TD.puntopright {
text-align: right;
vertical-align: top
}
TD.punquote {
background-color: #F6F6F6;
border: #606060;
border-style: dashed;
border-width: 1px
}
A:link, A:visited {
text-decoration: none;
color: #822100
}
A:link.punhot, A:visited.punhot { color: #005CB1 }
A:link.punclosed, A:visited.punclosed { color: #888888 }
A:hover {
text-decoration: none;
color: #CA3300
}
A:hover.punhot { color: #0099DD }
A:hover.punclosed { color: #AAAAAA }
IMG.punavatar {
margin-top: 3px;
margin-bottom: 3px
}
.puntext { font-size: 11px }
.punsignature { font-size: 10px }
.punheadline {
font-size: 12px;
font-weight: bold;
}
.punhot { color: #C03000 }

8
style/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

197
userlist.php Normal file
View File

@ -0,0 +1,197 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
if ($cookie['is_guest'] && $permissions['guests_read'] == '0')
message($lang_common['Login required'].' <a href="login.php">'.$lang_common['Login'].'</a> '.$lang_common['or'].' <a href="register.php">'.$lang_common['register'].'</a>.');
// Load the userlist.php language file
require 'lang/'.$language.'/'.$language.'_userlist.php';
$page_title = htmlspecialchars($options['board_title']).' / '.$lang_ul['User list'];
require 'header.php';
$id = isset($_GET['id']);
if ($id != 'other' && $id != 'all' && !preg_match('/^[a-zA-Z]$/', $id))
$id = 'A';
?>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead"><?php print $lang_ul['User list'] ?></td>
</tr>
<tr>
<td class="puncon2cent">
<?php
// Print out the alphabet
print "\t\t\t";
for ($i = 65; $i < 91; $i++)
{
if (ord($id ) != $i)
print '<b><a href="userlist.php?id='.chr($i).'">'.chr($i).'</a></b>&nbsp;&nbsp;';
else
print '<b>'.chr($i).'</b>&nbsp;&nbsp;';
}
print "\n";
?>
<?php print (strcasecmp($id, 'other')) ? '<a href="userlist.php?id=other">'.$lang_ul['Other'].'</a>'."\n" : $lang_ul['Other']."\n"; ?>&nbsp;&nbsp;<?php print (strcasecmp($id, 'all')) ? '<a href="userlist.php?id=all">'.$lang_ul['All users'].'</a>'."\n" : $lang_ul['All users']."\n"; ?>
</td>
</tr>
</table>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
if ($options['show_post_count'] == '0' && $cur_user['status'] < 1)
{
?>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 23%"><?php print $lang_common['Username'] ?></td>
<td class="punhead" style="width: 35%"><?php print $lang_common['E-mail'] ?></td>
<td class="punhead" style="width: 21%"><?php print $lang_common['Title'] ?></td>
<td class="punhead" style="width: 21%"><?php print $lang_common['Registered'] ?></td>
</tr>
<?php
}
else
{
?>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 18%"><?php print $lang_common['Username'] ?></td>
<td class="punhead" style="width: 30%"><?php print $lang_common['E-mail'] ?></td>
<td class="punhead" style="width: 20%"><?php print $lang_common['Title'] ?></td>
<td class="punhead" style="width: 17%"><?php print $lang_common['Registered'] ?></td>
<td class="punhead" style="width: 15%"><?php print $lang_common['Posts'] ?></td>
</tr>
<?php
}
if ($id == 'all')
$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch user list count', __FILE__, __LINE__, $db->error());
else if ($id == 'other')
{
switch ($db_type)
{
case 'mysql':
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'users WHERE id>1 AND username NOT REGEXP \'^[a-zA-Z]\'') or error('Unable to fetch user list count', __FILE__, __LINE__, $db->error());
break;
case 'pgsql';
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'users WHERE id>1 AND username !~ \'^[a-zA-Z]\'') or error('Unable to fetch user list count', __FILE__, __LINE__, $db->error());
break;
}
}
else
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'users WHERE id>1 AND username LIKE \''.$id.'%\'') or error('Unable to fetch user list count', __FILE__, __LINE__, $db->error());
$num_users = $db->result($result, 0);
// The number of pages required to display all users
$num_pages = ceil($num_users / 50);
if (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages)
{
$p = 1;
$start_from = 0;
}
else
{
$p = $_GET['p'];
$start_from = 50 * ($p - 1);
}
if ($id == 'all')
$result = $db->query('SELECT id, username, email, title, hide_email, num_posts, status, registered FROM '.$db->prefix.'users WHERE id>1 ORDER BY username LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());
else if ($id == 'other')
{
switch ($db_type)
{
case 'mysql':
$result = $db->query('SELECT id, username, email, title, hide_email, num_posts, status, registered FROM '.$db->prefix.'users WHERE id>1 AND username NOT REGEXP \'^[a-zA-Z]\' ORDER BY username LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());
break;
case 'pgsql';
$result = $db->query('SELECT id, username, email, title, hide_email, num_posts, status, registered FROM '.$db->prefix.'users WHERE id>1 AND username !~ \'^[a-zA-Z]\' ORDER BY username LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());
break;
}
}
else
$result = $db->query('SELECT id, username, email, title, hide_email, num_posts, status, registered FROM '.$db->prefix.'users WHERE id>1 AND username LIKE \''.$id.'%\' ORDER BY username LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());
$num_users_page = $db->num_rows($result);
if ($num_users_page)
{
while ($num_users_page--)
{
$user_data = $db->fetch_assoc($result);
$user_title = get_title($user_data);
?>
<tr class="puncon2">
<td><?php print '<a href="profile.php?id='.$user_data['id'].'">'.htmlspecialchars($user_data['username']).'</a>' ?></td>
<td><?php print ($user_data['hide_email'] == '0' || isset($cur_user['status']) > 0) ? '<a href="mailto:'.$user_data['email'].'">'.$user_data['email'].'</a>' : $lang_ul['Not displayed']; ?></td>
<td><?php print $user_title ?></td>
<td><?php print format_time($user_data['registered'], true) ?></td>
<?php if ($options['show_post_count'] == '1' || $cur_user['status'] > 0): ?> <td><?php print $user_data['num_posts'] ?></td>
<?php endif; ?> </tr>
<?php
}
}
else
print "\t".'<tr class="puncon2"><td colspan="5">'.$lang_ul['No users'].' "'.$id.'".</td></tr>'."\n";
?>
</table>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td><?php print $lang_common['Pages'].': '.paginate($num_pages, $p, 'userlist.php?id='.$id) ?></td>
</tr>
</table>
<?php
require 'footer.php';

237
viewforum.php Normal file
View File

@ -0,0 +1,237 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
if ($cookie['is_guest'] && $permissions['guests_read'] == '0')
message($lang_common['Login required'].' <a href="login.php">'.$lang_common['Login'].'</a> '.$lang_common['or'].' <a href="register.php">'.$lang_common['register'].'</a>.');
if (!$cookie['is_guest'])
{
$disp_topics = $cur_user['disp_topics'];
$disp_posts = $cur_user['disp_posts'];
}
else
{
$disp_topics = $options['disp_topics_default'];
$disp_posts = $options['disp_posts_default'];
}
$id = intval($_GET['id']);
if (empty($id) || $id < 0)
message($lang_common['Bad request']);
// Load the viewforum.php language file
require 'lang/'.$language.'/'.$language.'_forum.php';
// Fetch some info from the forum
$result = $db->query('SELECT forum_name, moderators, num_topics, closed, admmod_only FROM '.$db->prefix.'forums WHERE id='.$id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request'], true);
list($forum_name, $moderators, $num_topics, $closed, $admmod_only) = $db->fetch_row($result);
if ($admmod_only == '1' && $cur_user['status'] < 1)
message($lang_common['Bad request']);
$mods_array = array();
if ($moderators != '')
{
$mods_array = unserialize($moderators);
while (list($mod_username, $mod_id) = @each($mods_array))
$temp_array[] = '<a href="profile.php?id='.$mod_id.'">'.htmlspecialchars($mod_username).'</a>';
$mods_string = implode(', ', $temp_array);
}
if ($closed != '1')
{
if ($permissions['guests_post_topic'] == '0' && $cookie['is_guest'] || $permissions['users_post_topic'] == '0' && $cur_user['status'] < 1)
$post_link = '&nbsp;';
else
$post_link = '<a href="post.php?fid='.$id.'">'.$lang_forum['Post topic'].'</a>';
}
else
{
if ($cur_user['status'] > 1 || $cur_user['status'] == 1 && array_key_exists($cur_user['username'], $mods_array))
$post_link = $lang_forum['Forum closed'].' / <a href="post.php?fid='.$id.'">'.$lang_forum['Post topic'].'</a>';
else
$post_link = $lang_forum['Forum closed'];
}
$page_title = htmlspecialchars($options['board_title']).' / '.htmlspecialchars($forum_name);
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td style="width: 53%"><b><a href="index.php"><?php print htmlspecialchars($options['board_title']) ?></a> / <?php print htmlspecialchars($forum_name) ?></b></td>
<td class="punright" style="width: 28%"><?php print (!empty($mods_array)) ? $lang_forum['Moderated by'].' '.$mods_string : '&nbsp;' ?></td>
<td class="punright" style="width: 19%; white-space: nowrap"><b><?php print $post_link ?></b></td>
</tr>
</table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 24px">&nbsp;</td>
<td class="punhead" style="white-space: nowrap"><?php print $lang_common['Topic'] ?></td>
<td class="punhead" style="width: 14%; white-space: nowrap"><?php print $lang_common['Author'] ?></td>
<td class="punheadcent" style="width: 7%; white-space: nowrap"><?php print $lang_common['Replies'] ?></td>
<td class="punheadcent" style="width: 7%; white-space: nowrap"><?php print $lang_forum['Views'] ?></td>
<td class="punhead" style="width: 25%; white-space: nowrap"><?php print $lang_common['Last post'] ?></td>
</tr>
<?php
// The number of pages required to display all topics (depending on $disp_topics setting)
$num_pages = ceil($num_topics / $disp_topics);
if (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages)
{
$p = 1;
$start_from = 0;
}
else
{
$p = $_GET['p'];
$start_from = $disp_topics * ($p - 1);
}
// Fetch topics (with or without "the dot")
if ($cookie['is_guest'] || $options['show_dot'] == '0')
{
// Without "the dot"
$result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());
}
else
{
// Fetch topic ID's
$result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());
$threadids = '0';
while ($row = $db->fetch_row($result))
$threadids .= ','.$row[0];
// Fetch topics
$result = $db->query('SELECT DISTINCT p.poster_id AS has_posted, t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$cur_user['id'].' WHERE t.id IN('.$threadids.') ORDER BY sticky DESC, last_post DESC') or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());
}
// If there are topics in this forum.
if ($db->num_rows($result))
{
while ($cur_topic = $db->fetch_assoc($result))
{
if ($cur_topic['moved_to'] == null)
$last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> '.$lang_common['by'].' '.htmlspecialchars($cur_topic['last_poster']);
else
$last_post = '&nbsp;';
if ($options['censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
if ($cur_topic['moved_to'] != 0)
$subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.htmlspecialchars($cur_topic['subject']).'</a>';
else if ($cur_topic['closed'] != '1' && $closed != '1')
$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.htmlspecialchars($cur_topic['subject']).'</a>';
else
$subject = '<a class="punclosed" href="viewtopic.php?id='.$cur_topic['id'].'">'.htmlspecialchars($cur_topic['subject']).'</a>';
if (!$cookie['is_guest'] && $cur_topic['last_post'] > $cookie['last_timeout'] && $cur_topic['moved_to'] == null)
{
if ($cur_user['show_img'] != '0')
$icon = '<img src="img/'.$cur_user['style'].'_new.png" width="16" height="16" alt="">';
else
$icon = '<span class="puntext"><b>&#8226;</b></span>';
$subject = '<b>'.$subject.'</b>';
}
else
$icon = '&nbsp;';
// Should we display the dot or not? :)
if (!$cookie['is_guest'] && $options['show_dot'] == '1')
{
if ($cur_topic['has_posted'] == $cur_user['id'])
$subject = '<b>&middot;</b>&nbsp;'.$subject;
else
$subject = '&nbsp;&nbsp;'.$subject;
}
if ($cur_topic['sticky'] == '1')
$subject = $lang_forum['Sticky'].': '.$subject;
$num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $disp_posts);
if ($num_pages_topic > 1)
{
$stop = ($num_pages_topic < 3) ? ($num_pages_topic + 1) : 4;
$subject .= '&nbsp;&nbsp;[';
for ($current=1; $current < $stop; $current++)
$subject .= '&nbsp;<a href="viewtopic.php?id='.$cur_topic['id'].'&amp;p='.$current.'">'.$current.'</a>';
if ($num_pages_topic > 3)
$subject .= '&nbsp;-&nbsp;<a href="viewtopic.php?id='.$cur_topic['id'].'&amp;p='.$num_pages_topic.'">'.$lang_common['Last page'].'</a>&nbsp;]';
else
$subject .= '&nbsp;]';
}
?>
<tr class="puntopic">
<td class="puncon1cent"><?php print $icon ?></td>
<td class="puncon2"><?php print $subject ?></td>
<td class="puncon1"><?php print htmlspecialchars($cur_topic['poster']) ?></td>
<td class="puncon2cent"><?php print ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : '&nbsp;' ?></td>
<td class="puncon1cent"><?php print ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : '&nbsp;' ?></td>
<td class="puncon2" style="white-space: nowrap"><?php print $last_post ?></td>
</tr>
<?php
}
}
else
print "\t".'<tr><td class="puncon1" colspan="6">'.$lang_forum['Empty forum'].'</td></tr>'."\n";
?>
</table>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td><?php print $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewforum.php?id='.$id) ?></td>
<td class="punright"><b><?php print $post_link ?></b></td>
</tr>
</table>
<?php
$forum_id = $id;
$footer_style = 'forum';
require 'footer.php';

451
viewtopic.php Normal file
View File

@ -0,0 +1,451 @@
<?php
/***********************************************************************
Copyright (C) 2002, 2003 Rickard Andersson (punbb@telia.com)
This file is part of PunBB.
PunBB 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 2 of the License,
or (at your option) any later version.
PunBB 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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
require 'config.php';
require 'include/common.php';
if ($cookie['is_guest'] && $permissions['guests_read'] == '0') {
message($lang_common['Login required'].' <a href="login.php">'.$lang_common['Login'].'</a> '.$lang_common['or'].' <a href="register.php">'.$lang_common['register'].'</a>.');
}
if ($cookie['is_guest']) {
$disp_posts = $options['disp_posts_default'];
} else {
$disp_posts = $cur_user['disp_posts'];
}
if (isset($_GET['id'])) {
$id = filter_var($_GET['id'], FILTER_VALIDATE_INT);
} else {
$id = 0; // or some other default value
}
if (isset($_GET['pid'])) {
$pid = filter_var($_GET['pid'], FILTER_VALIDATE_INT);
} else {
$pid = 0; // or some other default value
}
if ($id < 0 && $pid < 0) {
message($lang_common['Bad request']);
}
// Load the viewtopic.php language file
require 'lang/'.$language.'/'.$language.'_topic.php';
// If a pid (post ID) is specified we find out the topic ID and page in that topic
// so we can redirect to the correct message
if (isset($_GET['pid']))
{
$pid = $_GET['pid'];
$result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$id = $db->result($result, 0);
// Determine on what page the post is located (depending on $disp_posts)
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$num_posts = $db->num_rows($result);
for ($i = 0; $i < $num_posts; $i++)
{
$curid = $db->result($result, $i);
if ($curid == $pid)
break;
}
$i++; // we started at 0
$_GET['p'] = ceil($i / $disp_posts);
}
// Fetch some info from the topic
$result = $db->query('SELECT subject, closed, sticky, subscribers, num_replies, forum_id FROM '.$db->prefix.'topics WHERE id='.$id.' AND moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
list($subject, $closed, $sticky, $subscribers, $num_replies, $forum_id) = $db->fetch_row($result);
$result = $db->query('SELECT forum_name, moderators, closed, admmod_only FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
list($forum_name, $moderators, $forum_closed, $admmod_only) = $db->fetch_row($result);
$mods_array = array();
if ($moderators != '')
{
$mods_array = unserialize($moderators);
while (list($mod_username, $mod_id) = @each($mods_array))
$temp_array[] = '<a href="profile.php?id='.$mod_id.'">'.htmlspecialchars($mod_username).'</a>';
$mods_string = implode(', ', $temp_array);
}
if (isset($cur_user['status']) == 2 || (isset($cur_user['status']) == 1 && array_key_exists($cur_user['username'], $mods_array)))
$is_admmod = true;
else
$is_admmod = false;
if ($admmod_only == '1' && $cur_user['status'] < 1)
message($lang_common['Bad request']);
if ($closed != '1' && $forum_closed != '1')
{
if ($permissions['guests_post'] == '0' && $cookie['is_guest'] || $permissions['users_post'] == '0' && $cur_user['status'] < 1)
$post_link = '&nbsp;';
else
$post_link = '<a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
}
else
{
if ($is_admmod)
$post_link = $lang_topic['Topic closed'].' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
else
$post_link = $lang_topic['Topic closed'];
}
$num_pages = ceil(($num_replies + 1) / $disp_posts);
if (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages)
{
$p = 1;
$start_from = 0;
}
else
{
$p = $_GET['p'];
$start_from = $disp_posts * ($p - 1);
}
$pages = paginate($num_pages, $p, 'viewtopic.php?id='.$id);
if ($options['censoring'] == '1')
$subject = censor_words($subject);
$page_title = htmlspecialchars($options['board_title']).' / '.$subject;
$validate_form = ($options['quickpost'] == '1') ? true : false;
require 'header.php';
?>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td style="width: 53%"><b><a href="index.php"><?php print htmlspecialchars($options['board_title']) ?></a> / <a href="viewforum.php?id=<?php print $forum_id ?>"><?php print htmlspecialchars($forum_name) ?></a> / <?php print htmlspecialchars($subject) ?></b></td>
<td class="punright" style="width: 28%"><?php print (!empty($mods_array)) ? $lang_topic['Moderated by'].' '.$mods_string : '&nbsp;' ?></td>
<td class="punright" style="width: 19%; white-space: nowrap"><b><?php print $post_link ?></b></td>
</tr>
</table>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" style="width: 185px; white-space: nowrap"><?php print $lang_common['Author'] ?></td>
<td style="white-space: nowrap">
<table class="punplain" cellspacing="0" cellpadding="0">
<tr>
<td class="punhead" style="width: 20%"><?php print $lang_common['Message'] ?></td>
<td><?php print $lang_common['Pages'].': '.$pages ?></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
// Build an array of user_id's online
$result = $db->query('SELECT user_id FROM '.$db->prefix.'online WHERE user_id>0') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
$num_online = $db->num_rows($result);
for ($i = 0; $i < $num_online; $i++)
$online_list[] = $db->result($result, $i);
require 'include/parser.php';
// Used for switching background color in posts
$bg_switch = true;
// Retrieve the topic posts (and their respective poster)
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.hide_email, u.num_posts, u.status, u.registered, u.admin_note, p.id, p.poster, p.poster_id, p.poster_ip, p.poster_email, p.message, p.smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$id.' ORDER BY p.posted LIMIT '.$start_from.','.$disp_posts) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
while ($cur_post = $db->fetch_assoc($result))
{
// If the poster is a registered user.
if ($cur_post['poster_id'] > 1)
{
$registered = date($options['date_format'], $cur_post['registered']);
if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
$info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'"><u>'.htmlspecialchars($cur_post['poster']).'</u></a></span>';
else
$info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'">'.htmlspecialchars($cur_post['poster']).'</a></span>';
// getTitle() requires that an element 'username' be present in the array
$cur_post['username'] = $cur_post['poster'];
$user_title = get_title($cur_post);
if ($options['censoring'] == '1')
$user_title = censor_words($user_title);
$info .= '<br>'."\n\t\t\t\t\t\t".$user_title.'<br>';
if ($options['avatars'] == '1' && $cur_post['use_avatar'] == '1')
{
if ($img_size = @getimagesize($options['avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$info .= "\n\t\t\t\t\t\t".'<img class="punavatar" src="'.$options['avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' alt=""><br>';
else if ($img_size = @getimagesize($options['avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$info .= "\n\t\t\t\t\t\t".'<img class="punavatar" src="'.$options['avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' alt=""><br>';
else if ($img_size = @getimagesize($options['avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$info .= "\n\t\t\t\t\t\t".'<img class="punavatar" src="'.$options['avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' alt=""><br>';
else
$info .= '<br>'."\n\t\t\t\t\t\t";
}
else
$info .= '<br>'."\n\t\t\t\t\t\t";
if ($cur_post['location'] != '')
{
if ($options['censoring'] == '1')
$cur_post['location'] = censor_words($cur_post['location']);
$info .= $lang_topic['From'].': '.htmlspecialchars($cur_post['location']).'<br>'."\n\t\t\t\t\t\t";
}
$info .= $lang_common['Registered'].': '.$registered.'<br>';
if ($options['show_post_count'] == '1')
$info .= "\n\t\t\t\t\t\t".$lang_common['Posts'].': '.$cur_post['num_posts'];
if (isset($cur_user['status']) > 0)
{
$info .= '<br>'."\n\t\t\t\t\t\t".'IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';
if ($cur_post['admin_note'] != '')
$info .= '<br><br>'."\n\t\t\t\t\t\t".$lang_topic['Note'].': <b>'.$cur_post['admin_note'].'</b>';
}
// Generate the string for the links that appear at the bottom of every message.
$links = array();
if ($cur_post['hide_email'] == '0')
$links[] = '<a href="mailto:'.$cur_post['email'].'">'.$lang_common['E-mail'].'</a>';
if ($cur_post['url'] != '')
{
if ($cur_user['link_to_new_win'] == '0')
$links[] = '<a href="'.htmlspecialchars($cur_post['url']).'">'.$lang_topic['Website'].'</a>';
else
$links[] = '<a href="'.htmlspecialchars($cur_post['url']).'" target="_blank">'.$lang_topic['Website'].'</a>';
}
}
// If the poster is a guest (or a user that has been deleted)
else
{
$info = '<span class="punheadline">'.htmlspecialchars($cur_post['poster']).'</span><br>'."\n\t\t\t\t\t\t".$lang_topic['Guest'];
if (isset($cur_user['status']) > 0)
$info .= '<br><br>'."\n\t\t\t\t\t\t".'IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a><br><br>';
else
$info .= '<br><br><br><br>';
if ($cur_post['poster_email'] != '')
$links = array('<a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['E-mail'].'</a>');
else
$links = array();
}
if ($cur_post['edited'])
$edited = $lang_topic['Last edit'].' '.htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')';
else
$edited = '&nbsp;';
$actions = array();
if (!$is_admmod)
{
if (!$cookie['is_guest'])
{
$actions[] = '<a class="punclosed" href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>';
if ($closed != '1' && $forum_closed != '1')
{
if ($permissions['users_edit_post'] == '1' && $cur_post['poster_id'] == $cur_user['id'])
{
if ($permissions['users_del_post'] == '1')
$actions[] = '<a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
$actions[] = '<a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
}
$actions[] = '<a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
}
}
else
{
if ($permissions['guests_post'] == '1' && $closed != '1' && $forum_closed != '1')
$actions[] = '<a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
}
}
else
$actions[] = '<a class="punclosed" href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a> | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a> | <a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
// Switch the background color for every message.
$bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true;
// Perform the main parsing of the message (BBCode, smilies, censor words etc)
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['smilies']);
if ($cur_post['signature'] != '' && $cur_user['show_sig'] != '0')
$signature = '<br><br>_______________________________________<br>'.parse_signature($cur_post['signature']).'<br><br>';
else
$signature = NULL;
?>
<div><a name="<?php print $cur_post['id'] ?>"></a></div>
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="<?php print ($bg_switch) ? 'puncon1' : 'puncon2'; ?>">
<td class="puntop" style="width: 185px">
<table class="punplain" cellspacing="0" cellpadding="0">
<tr>
<td>
<div style="width: 185px">
<?php print $info."\n" ?>
</div>
</td>
</tr>
</table>
</td>
<td class="puntop">
<table class="punplain" cellspacing="0" cellpadding="0">
<tr>
<td>
<span class="puntext"><?php print $cur_post['message'] ?></span><?php print ($signature != NULL) ? '<span class="punsignature">'.$signature.'</span>'."\n" : '<br><br>'."\n"; ?>
</td>
</tr>
</table>
</td>
</tr>
<tr class="<?php print ($bg_switch) ? 'puncon1' : 'puncon2'; ?>">
<td style="width: 185px; white-space: nowrap"><?php print format_time($cur_post['posted']) ?></td>
<td>
<table class="punplain" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 47%"><?php print $edited ?></td>
<td style="width: 20%"><?php print (count($links) > 0) ? implode(' | ', $links) : '&nbsp;'; ?></td>
<td class="punright" style="width: 33%"><?php print (count($actions) > 0) ? implode(' | ', $actions) : '&nbsp;'; ?></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
if (!$cookie['is_guest'] && $options['subscriptions'] == '1')
{
if (strstr($subscribers, $cur_user['email']))
// I apologize for the choice of variable name here. It's a mix of subscription and action I guess :-)
$subscraction = $lang_topic['Is subscribed'].' - <a href="misc.php?unsubscribe='.$id.'">'.$lang_topic['Unsubscribe'].'</a>';
else
$subscraction = '<a href="misc.php?subscribe='.$id.'">'.$lang_topic['Subscribe'].'</a>';
}
else
$subscraction = '&nbsp;';
?>
<table class="punplain" cellspacing="1" cellpadding="4">
<tr>
<td style="width: 46%"><?php print $lang_common['Pages'].': '.$pages ?></td>
<td class="punright" style="width: 35%"><?php print $subscraction ?></td>
<td class="punright" style="width: 19%"><b><?php print $post_link ?></b></td>
</tr>
</table>
<?php
// Display quick post if enabled
if (!$cookie['is_guest'] && $options['quickpost'] == '1' && $permissions['users_post'] == '1')
{
if (($closed == '0' && $forum_closed == '0') || $is_admmod)
{
?>
<form method="post" action="post.php?tid=<?php print $id ?>" onsubmit="return process_form(this)">
<input type="hidden" name="form_sent" value="1">
<input type="hidden" name="form_user" value="<?php print (!$cookie['is_guest']) ? htmlspecialchars($cur_user['username']) : 'Guest'; ?>">
<input type="hidden" name="smilies" value="<?php print $cur_user['smilies'] ?>">
<input type="hidden" name="subscribe" value="0">
<table class="punmain" cellspacing="1" cellpadding="4">
<tr class="punhead">
<td class="punhead" colspan="2"><?php print $lang_topic['Quick post'] ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">
<b><?php print $lang_common['Message'] ?></b>&nbsp;&nbsp;<br><br>
HTML: <?php print ($permissions['message_html'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">BBCode</a>: <?php print ($permissions['message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">[img] tag</a>: <?php print ($permissions['message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;<br>
<a href="help.php" target="_blank">Smilies</a>: <?php print ($options['smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>&nbsp;&nbsp;
</td>
<td class="puncon2">&nbsp;<textarea name="req_message" rows="7" cols="80"></textarea></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>&nbsp;&nbsp;</td>
<td class="puncon2"><br>&nbsp;&nbsp;<input type="submit" name="submit" value="<?php print $lang_common['Submit'] ?>" accesskey="s"><br><br></td>
</tr>
</table>
</form>
<table class="punplain" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php
}
}
// Increment "num_views" for topic
$db->query('UPDATE '.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
$footer_style = 'topic';
require 'footer.php';