init
Fork my modification of FluxBB https://github.com/MioVisman/FluxBB_by_Visman
340
COPYING
Normal 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.
|
1
addons/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
174
addons/security_for_login.php
Normal file
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2015 Visman (mio.visman@yandex.ru)
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
class addon_security_for_login extends flux_addon
|
||||
{
|
||||
var $version;
|
||||
var $att_period;
|
||||
var $att_max;
|
||||
var $time_min;
|
||||
var $time_max;
|
||||
var $form_key;
|
||||
|
||||
|
||||
function register($manager)
|
||||
{
|
||||
global $pun_user;
|
||||
|
||||
if (!$pun_user['is_guest']) return;
|
||||
|
||||
$this->version = '1.0.0';
|
||||
$this->att_period = 15;
|
||||
$this->att_max = 3;
|
||||
$this->time_min = 3;
|
||||
$this->time_max = 3600;
|
||||
$this->form_key = 'form_key';
|
||||
|
||||
$manager->bind('login_before_header', array($this, 'hook_login_before_header'));
|
||||
$manager->bind('login_before_submit', array($this, 'hook_login_before_submit'));
|
||||
$manager->bind('login_before_validation', array($this, 'hook_login_before_validation'));
|
||||
}
|
||||
|
||||
|
||||
function hook_login_before_header()
|
||||
{
|
||||
global $db, $pun_config;
|
||||
|
||||
if (empty($pun_config['o_sec_of_login']) || $pun_config['o_sec_of_login'] != $this->version)
|
||||
{
|
||||
$db->drop_table('sec_of_login') or error('Unable to drop sec_of_login table', __FILE__, __LINE__, $db->error());
|
||||
$db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name LIKE \'o\_sec\_of\_login%\'') or error('Unable to remove config entries', __FILE__, __LINE__, $db->error());;
|
||||
|
||||
$schema = array
|
||||
(
|
||||
'FIELDS' => array(
|
||||
'form_key' => array(
|
||||
'datatype' => 'varchar(40)',
|
||||
'allow_null' => false
|
||||
),
|
||||
'form_time' => array(
|
||||
'datatype' => 'INT(10) UNSIGNED',
|
||||
'allow_null' => false,
|
||||
'default' => '0'
|
||||
),
|
||||
'form_ip' => array(
|
||||
'datatype' => 'varchar(39)',
|
||||
'allow_null' => false
|
||||
),
|
||||
'form_captcha' => array(
|
||||
'datatype' => 'varchar(40)',
|
||||
'allow_null' => false
|
||||
)
|
||||
),
|
||||
'INDEXES' => array(
|
||||
'form_key_idx' => array('form_key'),
|
||||
'form_time_idx' => array('form_time')
|
||||
)
|
||||
);
|
||||
|
||||
$db->create_table('sec_of_login', $schema) or error('Unable to create sec_of_login table', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_sec_of_login\', \''.$db->escape($this->version).'\')') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_sec_of_login_time\', \''.$db->escape(time()).'\')') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$this->gen_cache();
|
||||
}
|
||||
else if (time() - $this->time_max > $pun_config['o_sec_of_login_time'])
|
||||
{
|
||||
$db->query('DELETE FROM '.$db->prefix.'sec_of_login WHERE form_time<'.(time() - $this->time_max)) or error('Unable to delete sec_of_login data', __FILE__, __LINE__, $db->error());
|
||||
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$db->escape(time()).'\' WHERE conf_name=\'o_sec_of_login_time\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$this->gen_cache();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function hook_login_before_submit()
|
||||
{
|
||||
global $db;
|
||||
|
||||
$now = time();
|
||||
$ip = get_remote_address();
|
||||
$key = pun_hash($now.$ip.uniqid(rand(), true));
|
||||
$form_captcha = '';
|
||||
|
||||
$result = $db->query('SELECT 1 FROM '.$db->prefix.'sec_of_login WHERE form_time>'.($now - $this->att_period).' LIMIT '.($this->att_max)) or error('Unable to get sec_of_login data', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result) == $this->att_max)
|
||||
{
|
||||
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
|
||||
include PUN_ROOT.'include/security.php';
|
||||
|
||||
$form_captcha = security_show_captcha(4);
|
||||
}
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'sec_of_login (form_key, form_time, form_ip, form_captcha) VALUES(\''.$db->escape($key).'\', '.$now.', \''.$db->escape($ip).'\', \''.$db->escape($form_captcha).'\')') or error('Unable to insert data in sec_of_login', __FILE__, __LINE__, $db->error());
|
||||
|
||||
echo "\t\t\t".'<input type="hidden" name="'.pun_htmlspecialchars($this->form_key).'" value="'.pun_htmlspecialchars($key).'" />'."\n";
|
||||
}
|
||||
|
||||
|
||||
function hook_login_before_validation()
|
||||
{
|
||||
global $db, $errors;
|
||||
|
||||
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
|
||||
include PUN_ROOT.'include/security.php';
|
||||
|
||||
$now = time();
|
||||
|
||||
if (!isset($_POST[$this->form_key]))
|
||||
{
|
||||
$errors[] = security_msg('1');
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($_POST['req_username']) || empty($_POST['req_password']) || empty($_POST['redirect_url']))
|
||||
$errors[] = security_msg('1');
|
||||
|
||||
if (security_test_browser())
|
||||
$errors[] = security_msg('2');
|
||||
|
||||
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_login WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\' LIMIT 1') or error('Unable to get sec_of_login data', __FILE__, __LINE__, $db->error());
|
||||
$cur_form = $db->fetch_assoc($result);
|
||||
|
||||
if (empty($cur_form['form_time']) || $cur_form['form_captcha'] == 'error')
|
||||
{
|
||||
$errors[] = security_msg('3');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($cur_form['form_ip'] != get_remote_address())
|
||||
$errors[] = security_msg('4');
|
||||
|
||||
if ($now - $this->time_min < $cur_form['form_time'])
|
||||
$errors[] = security_msg('5');
|
||||
|
||||
if ($now - $this->time_max > $cur_form['form_time'])
|
||||
$errors[] = security_msg('6');
|
||||
|
||||
if (!empty($cur_form['form_captcha']))
|
||||
{
|
||||
$verify_captcha = security_verify_captcha($cur_form['form_captcha']);
|
||||
if ($verify_captcha !== true)
|
||||
$errors[] = security_msg($verify_captcha);
|
||||
}
|
||||
|
||||
if (empty($errors))
|
||||
$db->query('DELETE FROM '.$db->prefix.'sec_of_login WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to delete sec_of_login data', __FILE__, __LINE__, $db->error());
|
||||
else
|
||||
$db->query('UPDATE '.$db->prefix.'sec_of_login SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to update sec_of_login data', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
|
||||
function gen_cache()
|
||||
{
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_config_cache();
|
||||
}
|
||||
}
|
173
addons/security_for_post.php
Normal file
|
@ -0,0 +1,173 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2015 Visman (mio.visman@yandex.ru)
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
class addon_security_for_post extends flux_addon
|
||||
{
|
||||
var $version;
|
||||
var $att_period;
|
||||
var $att_max;
|
||||
var $time_min;
|
||||
var $time_max;
|
||||
var $form_key;
|
||||
|
||||
|
||||
function register($manager)
|
||||
{
|
||||
global $pun_user;
|
||||
|
||||
if (!$pun_user['is_guest']) return;
|
||||
|
||||
$this->version = '1.0.0';
|
||||
$this->att_period = 20;
|
||||
$this->att_max = 3;
|
||||
$this->time_min = 3;
|
||||
$this->time_max = 3600;
|
||||
$this->form_key = 'form_key';
|
||||
|
||||
$manager->bind('quickpost_before_submit', array($this, 'hook_post_before_submit'));
|
||||
$manager->bind('post_before_submit', array($this, 'hook_post_before_submit'));
|
||||
$manager->bind('post_after_validation', array($this, 'hook_post_after_validation'));
|
||||
}
|
||||
|
||||
|
||||
function hook_post_before_header()
|
||||
{
|
||||
global $db, $pun_config;
|
||||
|
||||
if (empty($pun_config['o_sec_of_post']) || $pun_config['o_sec_of_post'] != $this->version)
|
||||
{
|
||||
$db->drop_table('sec_of_post') or error('Unable to drop sec_of_post table', __FILE__, __LINE__, $db->error());
|
||||
$db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name LIKE \'o\_sec\_of\_post%\'') or error('Unable to remove config entries', __FILE__, __LINE__, $db->error());;
|
||||
|
||||
$schema = array
|
||||
(
|
||||
'FIELDS' => array(
|
||||
'form_key' => array(
|
||||
'datatype' => 'varchar(40)',
|
||||
'allow_null' => false
|
||||
),
|
||||
'form_time' => array(
|
||||
'datatype' => 'INT(10) UNSIGNED',
|
||||
'allow_null' => false,
|
||||
'default' => '0'
|
||||
),
|
||||
'form_ip' => array(
|
||||
'datatype' => 'varchar(39)',
|
||||
'allow_null' => false
|
||||
),
|
||||
'form_captcha' => array(
|
||||
'datatype' => 'varchar(100)',
|
||||
'allow_null' => false
|
||||
)
|
||||
),
|
||||
'INDEXES' => array(
|
||||
'form_key_idx' => array('form_key'),
|
||||
'form_time_idx' => array('form_time')
|
||||
)
|
||||
);
|
||||
|
||||
$db->create_table('sec_of_post', $schema) or error('Unable to create sec_of_post table', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_sec_of_post\', \''.$db->escape($this->version).'\')') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_sec_of_post_time\', \''.$db->escape(time()).'\')') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$this->gen_cache();
|
||||
}
|
||||
else if (time() - $this->time_max > $pun_config['o_sec_of_post_time'])
|
||||
{
|
||||
$db->query('DELETE FROM '.$db->prefix.'sec_of_post WHERE form_time<'.(time() - $this->time_max)) or error('Unable to delete sec_of_post data', __FILE__, __LINE__, $db->error());
|
||||
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$db->escape(time()).'\' WHERE conf_name=\'o_sec_of_post_time\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$this->gen_cache();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function hook_post_before_submit()
|
||||
{
|
||||
global $db, $pun_config;
|
||||
|
||||
$this->hook_post_before_header();
|
||||
|
||||
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
|
||||
include PUN_ROOT.'include/security.php';
|
||||
|
||||
$now = time();
|
||||
$ip = get_remote_address();
|
||||
$key = pun_hash($now.$ip.uniqid(rand(), true));
|
||||
|
||||
// $result = $db->query('SELECT 1 FROM '.$db->prefix.'sec_of_post WHERE form_time>'.($now - $this->att_period).' LIMIT '.($this->att_max)) or error('Unable to get sec_of_post data', __FILE__, __LINE__, $db->error());
|
||||
// $type = ($db->num_rows($result) == $this->att_max);
|
||||
$enable_acaptcha = isset($pun_config['o_enable_acaptcha']) && $pun_config['o_enable_acaptcha'] == '1';
|
||||
|
||||
$form_captcha = security_show_captcha(0, $enable_acaptcha, true);
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'sec_of_post (form_key, form_time, form_ip, form_captcha) VALUES(\''.$db->escape($key).'\', '.$now.', \''.$db->escape($ip).'\', \''.$db->escape($form_captcha).'\')') or error('Unable to insert data in sec_of_post', __FILE__, __LINE__, $db->error());
|
||||
|
||||
echo "\t\t\t".'<input type="hidden" name="'.pun_htmlspecialchars($this->form_key).'" value="'.pun_htmlspecialchars($key).'" />'."\n";
|
||||
}
|
||||
|
||||
|
||||
function hook_post_after_validation()
|
||||
{
|
||||
global $db, $pun_config, $errors;
|
||||
|
||||
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
|
||||
include PUN_ROOT.'include/security.php';
|
||||
|
||||
$now = time();
|
||||
|
||||
if (!isset($_POST[$this->form_key]))
|
||||
{
|
||||
$errors[] = security_msg('1');
|
||||
return;
|
||||
}
|
||||
|
||||
if (security_test_browser())
|
||||
$errors[] = security_msg('2');
|
||||
|
||||
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_post WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\' LIMIT 1') or error('Unable to get sec_of_post data', __FILE__, __LINE__, $db->error());
|
||||
$cur_form = $db->fetch_assoc($result);
|
||||
|
||||
if (empty($cur_form['form_time']) || $cur_form['form_captcha'] == 'error')
|
||||
{
|
||||
$errors[] = security_msg('3');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($cur_form['form_ip'] != get_remote_address())
|
||||
$errors[] = security_msg('4');
|
||||
|
||||
if ($now - $this->time_min < $cur_form['form_time'])
|
||||
$errors[] = security_msg('5');
|
||||
|
||||
if ($now - $this->time_max > $cur_form['form_time'])
|
||||
$errors[] = security_msg('6');
|
||||
|
||||
if (!empty($cur_form['form_captcha']))
|
||||
{
|
||||
$verify_captcha = security_verify_captcha($cur_form['form_captcha']);
|
||||
|
||||
if ($verify_captcha !== true)
|
||||
$errors[] = security_msg($verify_captcha);
|
||||
}
|
||||
|
||||
if (empty($errors))
|
||||
$db->query('DELETE FROM '.$db->prefix.'sec_of_post WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to delete sec_of_post data', __FILE__, __LINE__, $db->error());
|
||||
else
|
||||
$db->query('UPDATE '.$db->prefix.'sec_of_post SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to update sec_of_post data', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
|
||||
function gen_cache()
|
||||
{
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_config_cache();
|
||||
}
|
||||
}
|
174
addons/security_for_register.php
Normal file
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2015 Visman (mio.visman@yandex.ru)
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
class addon_security_for_register extends flux_addon
|
||||
{
|
||||
var $version;
|
||||
var $att_period;
|
||||
var $att_max;
|
||||
var $time_min;
|
||||
var $time_max;
|
||||
var $form_key;
|
||||
|
||||
|
||||
function register($manager)
|
||||
{
|
||||
global $pun_user;
|
||||
|
||||
if (!$pun_user['is_guest']) return;
|
||||
|
||||
$this->version = '1.0.0';
|
||||
$this->att_period = 20;
|
||||
$this->att_max = 3;
|
||||
$this->time_min = 3;
|
||||
$this->time_max = 3600;
|
||||
$this->form_key = 'form_key';
|
||||
|
||||
$manager->bind('register_before_header', array($this, 'hook_register_before_header'));
|
||||
$manager->bind('register_before_submit', array($this, 'hook_register_before_submit'));
|
||||
$manager->bind('register_after_validation', array($this, 'hook_register_after_validation'));
|
||||
}
|
||||
|
||||
|
||||
function hook_register_before_header()
|
||||
{
|
||||
global $db, $pun_config;
|
||||
|
||||
if (empty($pun_config['o_sec_of_register']) || $pun_config['o_sec_of_register'] != $this->version)
|
||||
{
|
||||
$db->drop_table('sec_of_register') or error('Unable to drop sec_of_register table', __FILE__, __LINE__, $db->error());
|
||||
$db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name LIKE \'o\_sec\_of\_register%\'') or error('Unable to remove config entries', __FILE__, __LINE__, $db->error());;
|
||||
|
||||
$schema = array
|
||||
(
|
||||
'FIELDS' => array(
|
||||
'form_key' => array(
|
||||
'datatype' => 'varchar(40)',
|
||||
'allow_null' => false
|
||||
),
|
||||
'form_time' => array(
|
||||
'datatype' => 'INT(10) UNSIGNED',
|
||||
'allow_null' => false,
|
||||
'default' => '0'
|
||||
),
|
||||
'form_ip' => array(
|
||||
'datatype' => 'varchar(39)',
|
||||
'allow_null' => false
|
||||
),
|
||||
'form_captcha' => array(
|
||||
'datatype' => 'varchar(100)',
|
||||
'allow_null' => false
|
||||
)
|
||||
),
|
||||
'INDEXES' => array(
|
||||
'form_key_idx' => array('form_key'),
|
||||
'form_time_idx' => array('form_time')
|
||||
)
|
||||
);
|
||||
|
||||
$db->create_table('sec_of_register', $schema) or error('Unable to create sec_of_register table', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_sec_of_register\', \''.$db->escape($this->version).'\')') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_sec_of_register_time\', \''.$db->escape(time()).'\')') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$this->gen_cache();
|
||||
}
|
||||
else if (time() - $this->time_max > $pun_config['o_sec_of_register_time'])
|
||||
{
|
||||
$db->query('DELETE FROM '.$db->prefix.'sec_of_register WHERE form_time<'.(time() - $this->time_max)) or error('Unable to delete sec_of_register data', __FILE__, __LINE__, $db->error());
|
||||
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$db->escape(time()).'\' WHERE conf_name=\'o_sec_of_register_time\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$this->gen_cache();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function hook_register_before_submit()
|
||||
{
|
||||
global $db, $pun_config;
|
||||
|
||||
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
|
||||
include PUN_ROOT.'include/security.php';
|
||||
|
||||
$now = time();
|
||||
$ip = get_remote_address();
|
||||
$key = pun_hash($now.$ip.uniqid(rand(), true));
|
||||
|
||||
// $result = $db->query('SELECT 1 FROM '.$db->prefix.'sec_of_register WHERE form_time>'.($now - $this->att_period).' LIMIT '.($this->att_max)) or error('Unable to get sec_of_register data', __FILE__, __LINE__, $db->error());
|
||||
// $type = ($db->num_rows($result) == $this->att_max);
|
||||
$enable_acaptcha = isset($pun_config['o_enable_acaptcha']) && $pun_config['o_enable_acaptcha'] == '1';
|
||||
|
||||
$form_captcha = security_show_captcha(0, $enable_acaptcha, true);
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'sec_of_register (form_key, form_time, form_ip, form_captcha) VALUES(\''.$db->escape($key).'\', '.$now.', \''.$db->escape($ip).'\', \''.$db->escape($form_captcha).'\')') or error('Unable to insert data in sec_of_register', __FILE__, __LINE__, $db->error());
|
||||
|
||||
echo "\t\t\t".'<input type="hidden" name="'.pun_htmlspecialchars($this->form_key).'" value="'.pun_htmlspecialchars($key).'" />'."\n";
|
||||
}
|
||||
|
||||
|
||||
function hook_register_after_validation()
|
||||
{
|
||||
global $db, $errors;
|
||||
|
||||
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
|
||||
include PUN_ROOT.'include/security.php';
|
||||
|
||||
$now = time();
|
||||
|
||||
if (!isset($_POST[$this->form_key]))
|
||||
{
|
||||
$errors[] = security_msg('1');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($_POST['req_user']) || !isset($_POST['req_email1']) || !isset($_POST['timezone']) || !isset($_POST['email_setting']))
|
||||
$errors[] = security_msg('1');
|
||||
|
||||
if (security_test_browser())
|
||||
$errors[] = security_msg('2');
|
||||
|
||||
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_register WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\' LIMIT 1') or error('Unable to get sec_of_register data', __FILE__, __LINE__, $db->error());
|
||||
$cur_form = $db->fetch_assoc($result);
|
||||
|
||||
if (empty($cur_form['form_time']) || $cur_form['form_captcha'] == 'error')
|
||||
{
|
||||
$errors[] = security_msg('3');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($cur_form['form_ip'] != get_remote_address())
|
||||
$errors[] = security_msg('4');
|
||||
|
||||
if ($now - $this->time_min < $cur_form['form_time'])
|
||||
$errors[] = security_msg('5');
|
||||
|
||||
if ($now - $this->time_max > $cur_form['form_time'])
|
||||
$errors[] = security_msg('6');
|
||||
|
||||
if (!empty($cur_form['form_captcha']))
|
||||
{
|
||||
$verify_captcha = security_verify_captcha($cur_form['form_captcha']);
|
||||
|
||||
if ($verify_captcha !== true)
|
||||
$errors[] = security_msg($verify_captcha);
|
||||
}
|
||||
|
||||
if (empty($errors))
|
||||
$db->query('DELETE FROM '.$db->prefix.'sec_of_register WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to delete sec_of_register data', __FILE__, __LINE__, $db->error());
|
||||
else
|
||||
$db->query('UPDATE '.$db->prefix.'sec_of_register SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to update sec_of_register data', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
|
||||
function gen_cache()
|
||||
{
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_config_cache();
|
||||
}
|
||||
}
|
572
admin_bans.php
Normal file
|
@ -0,0 +1,572 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0'))
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_bans.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_bans.php';
|
||||
|
||||
// Add/edit a ban (stage 1)
|
||||
if (isset($_REQUEST['add_ban']) || isset($_GET['edit_ban']))
|
||||
{
|
||||
if (isset($_GET['add_ban']) || isset($_POST['add_ban']))
|
||||
{
|
||||
// If the ID of the user to ban was provided through GET (a link from profile.php)
|
||||
if (isset($_GET['add_ban']))
|
||||
{
|
||||
$user_id = intval($_GET['add_ban']);
|
||||
if ($user_id < 2)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$result = $db->query('SELECT group_id, username, email FROM '.$db->prefix.'users WHERE id='.$user_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
list($group_id, $ban_user, $ban_email) = $db->fetch_row($result);
|
||||
else
|
||||
message($lang_admin_bans['No user ID message']);
|
||||
}
|
||||
else // Otherwise the username is in POST
|
||||
{
|
||||
$ban_user = pun_trim($_POST['new_ban_user']);
|
||||
|
||||
if ($ban_user != '')
|
||||
{
|
||||
$result = $db->query('SELECT id, group_id, username, email FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
list($user_id, $group_id, $ban_user, $ban_email) = $db->fetch_row($result);
|
||||
else
|
||||
message($lang_admin_bans['No user message']);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we're not banning an admin or moderator
|
||||
if (isset($group_id))
|
||||
{
|
||||
if ($group_id == PUN_ADMIN)
|
||||
message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user)));
|
||||
|
||||
$result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
|
||||
$is_moderator_group = $db->result($result);
|
||||
|
||||
if ($is_moderator_group)
|
||||
message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user)));
|
||||
}
|
||||
|
||||
// If we have a $user_id, we can try to find the last known IP of that user
|
||||
if (isset($user_id))
|
||||
{
|
||||
$result = $db->query('SELECT poster_ip FROM '.$db->prefix.'posts WHERE poster_id='.$user_id.' ORDER BY posted DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
|
||||
$ban_ip = ($db->num_rows($result)) ? $db->result($result) : '';
|
||||
|
||||
if ($ban_ip == '')
|
||||
{
|
||||
$result = $db->query('SELECT registration_ip FROM '.$db->prefix.'users WHERE id='.$user_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
|
||||
$ban_ip = ($db->num_rows($result)) ? $db->result($result) : '';
|
||||
}
|
||||
}
|
||||
|
||||
$mode = 'add';
|
||||
}
|
||||
else // We are editing a ban
|
||||
{
|
||||
$ban_id = intval($_GET['edit_ban']);
|
||||
if ($ban_id < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$result = $db->query('SELECT username, ip, email, message, expire FROM '.$db->prefix.'bans WHERE id='.$ban_id) or error('Unable to fetch ban info', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
list($ban_user, $ban_ip, $ban_email, $ban_message, $ban_expire) = $db->fetch_row($result);
|
||||
else
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600;
|
||||
$ban_expire = ($ban_expire != '') ? gmdate('Y-m-d', $ban_expire + $diff) : '';
|
||||
|
||||
$mode = 'edit';
|
||||
}
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']);
|
||||
$focus_element = array('bans2', 'ban_user');
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('bans');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_bans['Ban advanced head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="bans2" method="post" action="admin_bans.php">
|
||||
<div class="inform">
|
||||
<input type="hidden" name="mode" value="<?php echo $mode ?>" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<?php if ($mode == 'edit'): ?> <input type="hidden" name="ban_id" value="<?php echo $ban_id ?>" />
|
||||
<?php endif; ?> <fieldset>
|
||||
<legend><?php echo $lang_admin_bans['Ban advanced subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Username label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="ban_user" size="25" maxlength="25" value="<?php if (isset($ban_user)) echo pun_htmlspecialchars($ban_user); ?>" tabindex="1" />
|
||||
<span><?php echo $lang_admin_bans['Username help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['IP label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="ban_ip" size="45" maxlength="255" value="<?php if (isset($ban_ip)) echo pun_htmlspecialchars($ban_ip); ?>" tabindex="2" />
|
||||
<span><?php echo $lang_admin_bans['IP help'] ?><?php if ($ban_user != '' && isset($user_id)) printf(' '.$lang_admin_bans['IP help link'], '<a href="admin_users.php?ip_stats='.$user_id.'">'.$lang_admin_common['here'].'</a>') ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['E-mail label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="ban_email" size="40" maxlength="80" value="<?php if (isset($ban_email)) echo pun_htmlspecialchars($ban_email); ?>" tabindex="3" />
|
||||
<span><?php echo $lang_admin_bans['E-mail help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="topspace"><strong class="warntext"><?php echo $lang_admin_bans['Ban IP range info'] ?></strong></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_bans['Message expiry subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Ban message label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="ban_message" size="50" maxlength="255" value="<?php if (isset($ban_message)) echo pun_htmlspecialchars($ban_message); ?>" tabindex="4" />
|
||||
<span><?php echo $lang_admin_bans['Ban message help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Expire date label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="ban_expire" size="17" maxlength="10" value="<?php if (isset($ban_expire)) echo $ban_expire; ?>" tabindex="5" />
|
||||
<span><?php echo $lang_admin_bans['Expire date help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="submitend"><input type="submit" name="add_edit_ban" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="6" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
|
||||
// Add/edit a ban (stage 2)
|
||||
else if (isset($_POST['add_edit_ban']))
|
||||
{
|
||||
confirm_referrer('admin_bans.php');
|
||||
|
||||
$ban_user = pun_trim($_POST['ban_user']);
|
||||
$ban_ip = pun_trim($_POST['ban_ip']);
|
||||
$ban_email = strtolower(pun_trim($_POST['ban_email']));
|
||||
$ban_message = pun_trim($_POST['ban_message']);
|
||||
$ban_expire = pun_trim($_POST['ban_expire']);
|
||||
|
||||
if ($ban_user == '' && $ban_ip == '' && $ban_email == '')
|
||||
message($lang_admin_bans['Must enter message']);
|
||||
else if (strtolower($ban_user) == 'guest')
|
||||
message($lang_admin_bans['Cannot ban guest message']);
|
||||
|
||||
// Make sure we're not banning an admin or moderator
|
||||
if (!empty($ban_user))
|
||||
{
|
||||
$result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
{
|
||||
$group_id = $db->result($result);
|
||||
|
||||
if ($group_id == PUN_ADMIN)
|
||||
message(sprintf($lang_admin_bans['User is admin message'], pun_htmlspecialchars($ban_user)));
|
||||
|
||||
$result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
|
||||
$is_moderator_group = $db->result($result);
|
||||
|
||||
if ($is_moderator_group)
|
||||
message(sprintf($lang_admin_bans['User is mod message'], pun_htmlspecialchars($ban_user)));
|
||||
}
|
||||
}
|
||||
|
||||
// Validate IP/IP range (it's overkill, I know)
|
||||
if ($ban_ip != '')
|
||||
{
|
||||
$ban_ip = preg_replace('%\s{2,}%S', ' ', $ban_ip);
|
||||
$addresses = explode(' ', $ban_ip);
|
||||
$addresses = array_map('pun_trim', $addresses);
|
||||
|
||||
for ($i = 0; $i < count($addresses); ++$i)
|
||||
{
|
||||
if (strpos($addresses[$i], ':') !== false)
|
||||
{
|
||||
$octets = explode(':', $addresses[$i]);
|
||||
|
||||
for ($c = 0; $c < count($octets); ++$c)
|
||||
{
|
||||
$octets[$c] = ltrim($octets[$c], "0");
|
||||
|
||||
if ($c > 7 || (!empty($octets[$c]) && !ctype_xdigit($octets[$c])) || intval($octets[$c], 16) > 65535)
|
||||
message($lang_admin_bans['Invalid IP message']);
|
||||
}
|
||||
|
||||
$cur_address = implode(':', $octets);
|
||||
$addresses[$i] = $cur_address;
|
||||
}
|
||||
else
|
||||
{
|
||||
$octets = explode('.', $addresses[$i]);
|
||||
|
||||
for ($c = 0; $c < count($octets); ++$c)
|
||||
{
|
||||
$octets[$c] = (strlen($octets[$c]) > 1) ? ltrim($octets[$c], "0") : $octets[$c];
|
||||
|
||||
if ($c > 3 || preg_match('%[^0-9]%', $octets[$c]) || intval($octets[$c]) > 255)
|
||||
message($lang_admin_bans['Invalid IP message']);
|
||||
}
|
||||
|
||||
$cur_address = implode('.', $octets);
|
||||
$addresses[$i] = $cur_address;
|
||||
}
|
||||
}
|
||||
|
||||
$ban_ip = implode(' ', $addresses);
|
||||
}
|
||||
|
||||
require PUN_ROOT.'include/email.php';
|
||||
if ($ban_email != '' && !is_valid_email($ban_email))
|
||||
{
|
||||
if (!preg_match('%^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,63})$%', $ban_email))
|
||||
message($lang_admin_bans['Invalid e-mail message']);
|
||||
}
|
||||
|
||||
if ($ban_expire != '' && $ban_expire != 'Never')
|
||||
{
|
||||
$ban_expire = strtotime($ban_expire.' GMT');
|
||||
|
||||
if ($ban_expire == -1 || !$ban_expire)
|
||||
message($lang_admin_bans['Invalid date message'].' '.$lang_admin_bans['Invalid date reasons']);
|
||||
|
||||
$diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600;
|
||||
$ban_expire -= $diff;
|
||||
|
||||
if ($ban_expire <= time())
|
||||
message($lang_admin_bans['Invalid date message'].' '.$lang_admin_bans['Invalid date reasons']);
|
||||
}
|
||||
else
|
||||
$ban_expire = 'NULL';
|
||||
|
||||
$ban_user = ($ban_user != '') ? '\''.$db->escape($ban_user).'\'' : 'NULL';
|
||||
$ban_ip = ($ban_ip != '') ? '\''.$db->escape($ban_ip).'\'' : 'NULL';
|
||||
$ban_email = ($ban_email != '') ? '\''.$db->escape($ban_email).'\'' : 'NULL';
|
||||
$ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL';
|
||||
|
||||
if ($_POST['mode'] == 'add')
|
||||
$db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire, ban_creator) VALUES('.$ban_user.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.', '.$pun_user['id'].')') or error('Unable to add ban', __FILE__, __LINE__, $db->error());
|
||||
else
|
||||
$db->query('UPDATE '.$db->prefix.'bans SET username='.$ban_user.', ip='.$ban_ip.', email='.$ban_email.', message='.$ban_message.', expire='.$ban_expire.' WHERE id='.intval($_POST['ban_id'])) or error('Unable to update ban', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Regenerate the bans cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_bans_cache();
|
||||
|
||||
if ($_POST['mode'] == 'edit')
|
||||
redirect('admin_bans.php', $lang_admin_bans['Ban edited redirect']);
|
||||
else
|
||||
redirect('admin_bans.php', $lang_admin_bans['Ban added redirect']);
|
||||
}
|
||||
|
||||
// Remove a ban
|
||||
else if (isset($_GET['del_ban']))
|
||||
{
|
||||
confirm_referrer('admin_bans.php');
|
||||
|
||||
$ban_id = intval($_GET['del_ban']);
|
||||
if ($ban_id < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$db->query('DELETE FROM '.$db->prefix.'bans WHERE id='.$ban_id) or error('Unable to delete ban', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Regenerate the bans cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_bans_cache();
|
||||
|
||||
redirect('admin_bans.php', $lang_admin_bans['Ban removed redirect']);
|
||||
}
|
||||
|
||||
// Find bans
|
||||
else if (isset($_GET['find_ban']))
|
||||
{
|
||||
$form = isset($_GET['form']) ? $_GET['form'] : array();
|
||||
|
||||
// trim() all elements in $form
|
||||
$form = array_map('pun_trim', $form);
|
||||
$conditions = $query_str = array();
|
||||
|
||||
$expire_after = isset($_GET['expire_after']) ? pun_trim($_GET['expire_after']) : '';
|
||||
$expire_before = isset($_GET['expire_before']) ? pun_trim($_GET['expire_before']) : '';
|
||||
$order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? 'b.'.$_GET['order_by'] : 'b.username';
|
||||
$direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC';
|
||||
|
||||
$query_str[] = 'order_by='.$order_by;
|
||||
$query_str[] = 'direction='.$direction;
|
||||
|
||||
// Try to convert date/time to timestamps
|
||||
if ($expire_after != '')
|
||||
{
|
||||
$query_str[] = 'expire_after='.$expire_after;
|
||||
|
||||
$expire_after = strtotime($expire_after);
|
||||
if ($expire_after === false || $expire_after == -1)
|
||||
message($lang_admin_bans['Invalid date message']);
|
||||
|
||||
$conditions[] = 'b.expire>'.$expire_after;
|
||||
}
|
||||
if ($expire_before != '')
|
||||
{
|
||||
$query_str[] = 'expire_before='.$expire_before;
|
||||
|
||||
$expire_before = strtotime($expire_before);
|
||||
if ($expire_before === false || $expire_before == -1)
|
||||
message($lang_admin_bans['Invalid date message']);
|
||||
|
||||
$conditions[] = 'b.expire<'.$expire_before;
|
||||
}
|
||||
|
||||
$like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
|
||||
foreach ($form as $key => $input)
|
||||
{
|
||||
if ($input != '' && in_array($key, array('username', 'ip', 'email', 'message')))
|
||||
{
|
||||
$conditions[] = 'b.'.$db->escape($key).' '.$like_command.' \''.$db->escape(str_replace('*', '%', $input)).'\'';
|
||||
$query_str[] = 'form%5B'.$key.'%5D='.urlencode($input);
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch ban count
|
||||
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'bans as b WHERE b.id>0'.(!empty($conditions) ? ' AND '.implode(' AND ', $conditions) : '')) or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error());
|
||||
$num_bans = $db->result($result);
|
||||
|
||||
// Determine the ban offset (based on $_GET['p'])
|
||||
$num_pages = ceil($num_bans / 50);
|
||||
|
||||
$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']);
|
||||
$start_from = 50 * ($p - 1);
|
||||
|
||||
// Generate paging links
|
||||
$paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_bans.php?find_ban=&'.implode('&', $query_str));
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans'], $lang_admin_bans['Results head']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
?>
|
||||
<div class="linkst">
|
||||
<div class="inbox crumbsplus">
|
||||
<ul class="crumbs">
|
||||
<li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li>
|
||||
<li><span>» </span><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li>
|
||||
<li><span>» </span><strong><?php echo $lang_admin_bans['Results head'] ?></strong></li>
|
||||
</ul>
|
||||
<div class="pagepost">
|
||||
<p class="pagelink"><?php echo $paging_links ?></p>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="bans1" class="blocktable">
|
||||
<h2><span><?php echo $lang_admin_bans['Results head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tcl" scope="col"><?php echo $lang_admin_bans['Results username head'] ?></th>
|
||||
<th class="tc2" scope="col"><?php echo $lang_admin_bans['Results e-mail head'] ?></th>
|
||||
<th class="tc3" scope="col"><?php echo $lang_admin_bans['Results IP address head'] ?></th>
|
||||
<th class="tc4" scope="col"><?php echo $lang_admin_bans['Results expire head'] ?></th>
|
||||
<th class="tc5" scope="col"><?php echo $lang_admin_bans['Results message head'] ?></th>
|
||||
<th class="tc6" scope="col"><?php echo $lang_admin_bans['Results banned by head'] ?></th>
|
||||
<th class="tcr" scope="col"><?php echo $lang_admin_bans['Results actions head'] ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$result = $db->query('SELECT b.id, b.username, b.ip, b.email, b.message, b.expire, b.ban_creator, u.username AS ban_creator_username FROM '.$db->prefix.'bans AS b LEFT JOIN '.$db->prefix.'users AS u ON b.ban_creator=u.id WHERE b.id>0'.(!empty($conditions) ? ' AND '.implode(' AND ', $conditions) : '').' ORDER BY '.$db->escape($order_by).' '.$db->escape($direction).' LIMIT '.$start_from.', 50') or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
{
|
||||
while ($ban_data = $db->fetch_assoc($result))
|
||||
{
|
||||
|
||||
$actions = '<a href="admin_bans.php?edit_ban='.$ban_data['id'].'">'.$lang_admin_common['Edit'].'</a> | <a href="admin_bans.php?del_ban='.$ban_data['id'].'&csrf_hash='.csrf_hash().'">'.$lang_admin_common['Remove'].'</a>';
|
||||
$expire = format_time($ban_data['expire'], true);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="tcl"><?php echo ($ban_data['username'] != '') ? pun_htmlspecialchars($ban_data['username']) : ' ' ?></td>
|
||||
<td class="tc2"><?php echo ($ban_data['email'] != '') ? pun_htmlspecialchars($ban_data['email']) : ' ' ?></td>
|
||||
<td class="tc3"><?php echo ($ban_data['ip'] != '') ? pun_htmlspecialchars($ban_data['ip']) : ' ' ?></td>
|
||||
<td class="tc4"><?php echo $expire ?></td>
|
||||
<td class="tc5"><?php echo ($ban_data['message'] != '') ? pun_htmlspecialchars($ban_data['message']) : ' ' ?></td>
|
||||
<td class="tc6"><?php echo ($ban_data['ban_creator_username'] != '') ? '<a href="profile.php?id='.$ban_data['ban_creator'].'">'.pun_htmlspecialchars($ban_data['ban_creator_username']).'</a>' : $lang_admin_bans['Unknown'] ?></td>
|
||||
<td class="tcr"><?php echo $actions ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
echo "\t\t\t\t".'<tr><td class="tcl" colspan="7">'.$lang_admin_bans['No match'].'</td></tr>'."\n";
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="linksb">
|
||||
<div class="inbox crumbsplus">
|
||||
<div class="pagepost">
|
||||
<p class="pagelink"><?php echo $paging_links ?></p>
|
||||
</div>
|
||||
<ul class="crumbs">
|
||||
<li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li>
|
||||
<li><span>» </span><a href="admin_bans.php"><?php echo $lang_admin_common['Bans'] ?></a></li>
|
||||
<li><span>» </span><strong><?php echo $lang_admin_bans['Results head'] ?></strong></li>
|
||||
</ul>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']);
|
||||
$focus_element = array('bans', 'new_ban_user');
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('bans');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_bans['New ban head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="bans" method="post" action="admin_bans.php?action=more">
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_bans['Add ban subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Username label'] ?><div><input type="submit" name="add_ban" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="2" /></div></th>
|
||||
<td>
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<input type="text" name="new_ban_user" size="25" maxlength="25" tabindex="1" />
|
||||
<span><?php echo $lang_admin_bans['Username advanced help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h2 class="block2"><span><?php echo $lang_admin_bans['Ban search head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="find_bans" method="get" action="admin_bans.php">
|
||||
<p class="submittop"><input type="submit" name="find_ban" value="<?php echo $lang_admin_bans['Submit search'] ?>" tabindex="3" /></p>
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_bans['Ban search subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php echo $lang_admin_bans['Ban search info'] ?></p>
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Username label'] ?></th>
|
||||
<td><input type="text" name="form[username]" size="25" maxlength="25" tabindex="4" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['IP label'] ?></th>
|
||||
<td><input type="text" name="form[ip]" size="30" maxlength="255" tabindex="5" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['E-mail label'] ?></th>
|
||||
<td><input type="text" name="form[email]" size="30" maxlength="80" tabindex="6" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Message label'] ?></th>
|
||||
<td><input type="text" name="form[message]" size="30" maxlength="255" tabindex="7" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Expire after label'] ?></th>
|
||||
<td><input type="text" name="expire_after" size="10" maxlength="10" tabindex="8" />
|
||||
<span><?php echo $lang_admin_bans['Date help'] ?></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Expire before label'] ?></th>
|
||||
<td><input type="text" name="expire_before" size="10" maxlength="10" tabindex="9" />
|
||||
<span><?php echo $lang_admin_bans['Date help'] ?></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_bans['Order by label'] ?></th>
|
||||
<td>
|
||||
<select name="order_by" tabindex="10">
|
||||
<option value="username" selected="selected"><?php echo $lang_admin_bans['Order by username'] ?></option>
|
||||
<option value="ip"><?php echo $lang_admin_bans['Order by ip'] ?></option>
|
||||
<option value="email"><?php echo $lang_admin_bans['Order by e-mail'] ?></option>
|
||||
<option value="expire"><?php echo $lang_admin_bans['Order by expire'] ?></option>
|
||||
</select>   <select name="direction" tabindex="11">
|
||||
<option value="ASC" selected="selected"><?php echo $lang_admin_bans['Ascending'] ?></option>
|
||||
<option value="DESC"><?php echo $lang_admin_bans['Descending'] ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="submitend"><input type="submit" name="find_ban" value="<?php echo $lang_admin_bans['Submit search'] ?>" tabindex="12" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
272
admin_categories.php
Normal file
|
@ -0,0 +1,272 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_categories.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_categories.php';
|
||||
|
||||
// Add a new category
|
||||
if (isset($_POST['add_cat']))
|
||||
{
|
||||
confirm_referrer('admin_categories.php');
|
||||
|
||||
$new_cat_name = pun_trim($_POST['new_cat_name']);
|
||||
if ($new_cat_name == '')
|
||||
message($lang_admin_categories['Must enter name message']);
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'categories (cat_name) VALUES(\''.$db->escape($new_cat_name).'\')') or error('Unable to create category', __FILE__, __LINE__, $db->error());
|
||||
|
||||
redirect('admin_categories.php', $lang_admin_categories['Category added redirect']);
|
||||
}
|
||||
|
||||
// Delete a category
|
||||
else if (isset($_POST['del_cat']) || isset($_POST['del_cat_comply']))
|
||||
{
|
||||
confirm_referrer('admin_categories.php');
|
||||
|
||||
$cat_to_delete = intval($_POST['cat_to_delete']);
|
||||
if ($cat_to_delete < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if (isset($_POST['del_cat_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
|
||||
prune($cur_forum, 1, -1);
|
||||
|
||||
// Delete the forum
|
||||
$db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$cur_forum) 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 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());
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_subforums_cache(); // MOD subforums - Visman
|
||||
generate_quickjump_cache();
|
||||
|
||||
redirect('admin_categories.php', $lang_admin_categories['Category deleted redirect']);
|
||||
}
|
||||
else // If the user hasn't confirmed the delete
|
||||
{
|
||||
$result = $db->query('SELECT cat_name FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to fetch category info', __FILE__, __LINE__, $db->error());
|
||||
$cat_name = $db->result($result);
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Categories']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('categories');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_categories['Delete category head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_categories.php">
|
||||
<div class="inform">
|
||||
<input type="hidden" name="cat_to_delete" value="<?php echo $cat_to_delete ?>" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_categories['Confirm delete subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php printf($lang_admin_categories['Confirm delete info'], pun_htmlspecialchars($cat_name)) ?></p>
|
||||
<p class="warntext"><?php echo $lang_admin_categories['Delete category warn'] ?></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="buttons"><input type="submit" name="del_cat_comply" value="<?php echo $lang_admin_common['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
}
|
||||
|
||||
else if (isset($_POST['update'])) // Change position and name of the categories
|
||||
{
|
||||
confirm_referrer('admin_categories.php');
|
||||
|
||||
$categories = $_POST['cat'];
|
||||
if (empty($categories))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
foreach ($categories as $cat_id => $cur_cat)
|
||||
{
|
||||
$cur_cat['name'] = pun_trim($cur_cat['name']);
|
||||
$cur_cat['order'] = pun_trim($cur_cat['order']);
|
||||
|
||||
if ($cur_cat['name'] == '')
|
||||
message($lang_admin_categories['Must enter name message']);
|
||||
|
||||
if ($cur_cat['order'] == '' || preg_match('%[^0-9]%', $cur_cat['order']))
|
||||
message($lang_admin_categories['Must enter integer message']);
|
||||
|
||||
$db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cur_cat['name']).'\', disp_position='.$cur_cat['order'].' WHERE id='.intval($cat_id)) or error('Unable to update category', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_subforums_cache(); // MOD subforums - Visman
|
||||
generate_quickjump_cache();
|
||||
|
||||
redirect('admin_categories.php', $lang_admin_categories['Categories updated redirect']);
|
||||
}
|
||||
|
||||
// Generate an array with all categories
|
||||
$result = $db->query('SELECT id, cat_name, disp_position FROM '.$db->prefix.'categories ORDER BY disp_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_assoc($result);
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Categories']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('categories');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_categories['Add categories head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_categories.php">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_categories['Add categories subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_categories['Add category label'] ?><div><input type="submit" name="add_cat" value="<?php echo $lang_admin_categories['Add new submit'] ?>" tabindex="2" /></div></th>
|
||||
<td>
|
||||
<input type="text" name="new_cat_name" size="35" maxlength="80" tabindex="1" />
|
||||
<span><?php printf($lang_admin_categories['Add category help'], '<a href="admin_forums.php">'.$lang_admin_common['Forums'].'</a>') ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Delete categories head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_categories.php">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_categories['Delete categories subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_categories['Delete category label'] ?><div><input type="submit" name="del_cat" value="<?php echo $lang_admin_common['Delete'] ?>" tabindex="4" /></div></th>
|
||||
<td>
|
||||
<select name="cat_to_delete" tabindex="3">
|
||||
<?php
|
||||
|
||||
foreach ($cat_list as $cur_cat)
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n";
|
||||
|
||||
?>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_categories['Delete category help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($num_cats): ?> <h2 class="block2"><span><?php echo $lang_admin_categories['Edit categories head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_categories.php">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_categories['Edit categories subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table id="categoryedit">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tcl" scope="col"><?php echo $lang_admin_categories['Category name label'] ?></th>
|
||||
<th scope="col"><?php echo $lang_admin_categories['Category position label'] ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
foreach ($cat_list as $cur_cat)
|
||||
{
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="tcl"><input type="text" name="cat[<?php echo $cur_cat['id'] ?>][name]" value="<?php echo pun_htmlspecialchars($cur_cat['cat_name']) ?>" size="35" maxlength="80" /></td>
|
||||
<td><input type="text" name="cat[<?php echo $cur_cat['id'] ?>][order]" value="<?php echo $cur_cat['disp_position'] ?>" size="3" maxlength="3" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="fsetsubmit"><input type="submit" name="update" value="<?php echo $lang_admin_common['Update'] ?>" /></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?> </div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
187
admin_censoring.php
Normal file
|
@ -0,0 +1,187 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_censoring.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_censoring.php';
|
||||
|
||||
// Add a censor word
|
||||
if (isset($_POST['add_word']))
|
||||
{
|
||||
confirm_referrer('admin_censoring.php');
|
||||
|
||||
$search_for = pun_trim($_POST['new_search_for']);
|
||||
$replace_with = pun_trim($_POST['new_replace_with']);
|
||||
|
||||
if ($search_for == '')
|
||||
message($lang_admin_censoring['Must enter word message']);
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'censoring (search_for, replace_with) VALUES (\''.$db->escape($search_for).'\', \''.$db->escape($replace_with).'\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$word = $db->escape($search_for);
|
||||
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'censoring WHERE search_for IN (\''.$word.'\',\'*'.$word.'\',\''.$word.'*\',\'*'.$word.'*\')') or error('Unable to fetch censor word', __FILE__, __LINE__, $db->error());
|
||||
$nwords = $db->result($result);
|
||||
|
||||
// Regenerate the censoring cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_censoring_cache();
|
||||
|
||||
redirect('admin_censoring.php'.(($nwords > 1) ? '?censorflag=1' : ''), $lang_admin_censoring['Word added redirect']);
|
||||
}
|
||||
|
||||
// Update a censor word
|
||||
else if (isset($_POST['update']))
|
||||
{
|
||||
confirm_referrer('admin_censoring.php');
|
||||
|
||||
$id = intval(key($_POST['update']));
|
||||
|
||||
$search_for = pun_trim($_POST['search_for'][$id]);
|
||||
$replace_with = pun_trim($_POST['replace_with'][$id]);
|
||||
|
||||
if ($search_for == '')
|
||||
message($lang_admin_censoring['Must enter word message']);
|
||||
|
||||
$db->query('UPDATE '.$db->prefix.'censoring SET search_for=\''.$db->escape($search_for).'\', replace_with=\''.$db->escape($replace_with).'\' WHERE id='.$id) or error('Unable to update censor word', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$word = $db->escape($search_for);
|
||||
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'censoring WHERE search_for IN (\''.$word.'\',\'*'.$word.'\',\''.$word.'*\',\'*'.$word.'*\')') or error('Unable to fetch censor word', __FILE__, __LINE__, $db->error());
|
||||
$nwords = $db->result($result);
|
||||
|
||||
// Regenerate the censoring cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_censoring_cache();
|
||||
|
||||
redirect('admin_censoring.php'.(($nwords > 1) ? '?censorflag=1' : ''), $lang_admin_censoring['Word updated redirect']);
|
||||
}
|
||||
|
||||
// Remove a censor word
|
||||
else if (isset($_POST['remove']))
|
||||
{
|
||||
confirm_referrer('admin_censoring.php');
|
||||
|
||||
$id = intval(key($_POST['remove']));
|
||||
|
||||
$db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Regenerate the censoring cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_censoring_cache();
|
||||
|
||||
redirect('admin_censoring.php', $lang_admin_censoring['Word removed redirect']);
|
||||
}
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Censoring']);
|
||||
$focus_element = array('censoring', 'new_search_for');
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('censoring');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_censoring['Censoring head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="censoring" method="post" action="admin_censoring.php">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_censoring['Add word subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php echo $lang_admin_censoring['Add word info'].' '.($pun_config['o_censoring'] == '1' ? sprintf($lang_admin_censoring['Censoring enabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>') : sprintf($lang_admin_censoring['Censoring disabled'], '<a href="admin_options.php#censoring">'.$lang_admin_common['Options'].'</a>')) ?></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tcl" scope="col"><?php echo $lang_admin_censoring['Censored word label'] ?></th>
|
||||
<th class="tc2" scope="col"><?php echo $lang_admin_censoring['Replacement label'] ?></th>
|
||||
<th class="hidehead" scope="col"><?php echo $lang_admin_censoring['Action label'] ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tcl"><input type="text" name="new_search_for" size="24" maxlength="60" tabindex="1" /></td>
|
||||
<td class="tc2"><input type="text" name="new_replace_with" size="24" maxlength="60" tabindex="2" /></td>
|
||||
<td><input type="submit" name="add_word" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="3" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php if (isset($_GET['censorflag'])): ?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_censoring['Double'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><span style="color: red"><strong><?php echo $lang_admin_censoring['Double2'] ?></strong></span></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_censoring['Edit remove subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<?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))
|
||||
{
|
||||
|
||||
?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tcl" scope="col"><?php echo $lang_admin_censoring['Censored word label'] ?></th>
|
||||
<th class="tc2" scope="col"><?php echo $lang_admin_censoring['Replacement label'] ?></th>
|
||||
<th class="hidehead" scope="col"><?php echo $lang_admin_censoring['Action label'] ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($cur_word = $db->fetch_assoc($result))
|
||||
echo "\t\t\t\t\t\t\t\t".'<tr><td class="tcl"><input type="text" name="search_for['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['search_for']).'" size="24" maxlength="60" /></td><td class="tc2"><input type="text" name="replace_with['.$cur_word['id'].']" value="'.pun_htmlspecialchars($cur_word['replace_with']).'" size="24" maxlength="60" /></td><td><input type="submit" name="update['.$cur_word['id'].']" value="'.$lang_admin_common['Update'].'" /> <input type="submit" name="remove['.$cur_word['id'].']" value="'.$lang_admin_common['Remove'].'" /></td></tr>'."\n";
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
}
|
||||
else
|
||||
echo "\t\t\t\t\t\t\t".'<p>'.$lang_admin_censoring['No words in list'].'</p>'."\n";
|
||||
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
573
admin_forums.php
Normal file
|
@ -0,0 +1,573 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_forums.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_forums.php';
|
||||
|
||||
// Add a "default" forum
|
||||
if (isset($_POST['add_forum']))
|
||||
{
|
||||
confirm_referrer('admin_forums.php');
|
||||
|
||||
$add_to_cat = intval($_POST['add_to_cat']);
|
||||
if ($add_to_cat < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'forums (forum_name, cat_id) VALUES(\''.$db->escape($lang_admin_forums['New forum']).'\', '.$add_to_cat.')') or error('Unable to create forum', __FILE__, __LINE__, $db->error());
|
||||
$new_fid = $db->insert_id();
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_subforums_cache(); // MOD subforums - Visman
|
||||
generate_quickjump_cache();
|
||||
|
||||
redirect('admin_forums.php?edit_forum='.$new_fid, $lang_admin_forums['Forum added redirect']);
|
||||
}
|
||||
|
||||
// Delete a forum
|
||||
else if (isset($_GET['del_forum']))
|
||||
{
|
||||
confirm_referrer('admin_forums.php');
|
||||
|
||||
$forum_id = intval($_GET['del_forum']);
|
||||
if ($forum_id < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if (isset($_POST['del_forum_comply'])) // Delete a forum with all posts
|
||||
{
|
||||
@set_time_limit(0);
|
||||
|
||||
// Prune all posts and topics
|
||||
prune($forum_id, 1, -1);
|
||||
|
||||
// Locate any "orphaned redirect topics" and delete them
|
||||
$result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT 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 and any forum specific group permissions
|
||||
$db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error());
|
||||
$db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Delete any subscriptions for this forum
|
||||
$db->query('DELETE FROM '.$db->prefix.'forum_subscriptions WHERE forum_id='.$forum_id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_subforums_cache(); // MOD subforums - Visman
|
||||
generate_quickjump_cache();
|
||||
|
||||
redirect('admin_forums.php', $lang_admin_forums['Forum deleted redirect']);
|
||||
}
|
||||
else // If the user hasn't confirmed the delete
|
||||
{
|
||||
$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_name = pun_htmlspecialchars($db->result($result));
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('forums');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_forums['Confirm delete head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_forums.php?del_forum=<?php echo $forum_id ?>">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_forums['Confirm delete subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php printf($lang_admin_forums['Confirm delete info'], $forum_name) ?></p>
|
||||
<p class="warntext"><?php echo $lang_admin_forums['Confirm delete warn'] ?></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="buttons"><input type="submit" name="del_forum_comply" value="<?php echo $lang_admin_common['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
}
|
||||
|
||||
// Update forum positions
|
||||
else if (isset($_POST['update_positions']))
|
||||
{
|
||||
confirm_referrer('admin_forums.php');
|
||||
|
||||
foreach ($_POST['position'] as $forum_id => $disp_position)
|
||||
{
|
||||
$disp_position = trim($disp_position);
|
||||
if ($disp_position == '' || preg_match('%[^0-9]%', $disp_position))
|
||||
message($lang_admin_forums['Must be integer message']);
|
||||
|
||||
$db->query('UPDATE '.$db->prefix.'forums SET disp_position='.$disp_position.' WHERE id='.intval($forum_id)) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_subforums_cache(); // MOD subforums - Visman
|
||||
generate_quickjump_cache();
|
||||
|
||||
redirect('admin_forums.php', $lang_admin_forums['Forums updated redirect']);
|
||||
}
|
||||
|
||||
else if (isset($_GET['edit_forum']))
|
||||
{
|
||||
$forum_id = intval($_GET['edit_forum']);
|
||||
if ($forum_id < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
// Update group permissions for $forum_id
|
||||
if (isset($_POST['save']))
|
||||
{
|
||||
confirm_referrer('admin_forums.php');
|
||||
|
||||
// Start with the forum details
|
||||
$forum_name = pun_trim($_POST['forum_name']);
|
||||
$forum_desc = pun_linebreaks(pun_trim($_POST['forum_desc']));
|
||||
$cat_id = intval($_POST['cat_id']);
|
||||
$sort_by = intval($_POST['sort_by']);
|
||||
$redirect_url = isset($_POST['redirect_url']) ? pun_trim($_POST['redirect_url']) : null;
|
||||
|
||||
// MOD subforums - Visman
|
||||
$parent_forum_id = $i = intval($_POST['parent_forum']);
|
||||
while (isset($sf_array_desc[$i][0]))
|
||||
$i = $sf_array_desc[$i][0];
|
||||
|
||||
if ($i > 0 && (!isset($sf_array_tree[0][$i]) || $sf_array_tree[0][$i]['cid'] != $cat_id))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if ($forum_name == '')
|
||||
message($lang_admin_forums['Must enter name message']);
|
||||
|
||||
if ($cat_id < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$forum_desc = ($forum_desc != '') ? '\''.$db->escape($forum_desc).'\'' : 'NULL';
|
||||
$redirect_url = ($redirect_url != '') ? '\''.$db->escape($redirect_url).'\'' : 'NULL';
|
||||
|
||||
$db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.$db->escape($forum_name).'\', forum_desc='.$forum_desc.', redirect_url='.$redirect_url.', sort_by='.$sort_by.', cat_id='.$cat_id.', parent_forum_id='.$parent_forum_id.' WHERE id='.$forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); // MOD subforums - Visman
|
||||
|
||||
// Now let's deal with the permissions
|
||||
if (isset($_POST['read_forum_old']))
|
||||
{
|
||||
$result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN) or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
|
||||
while ($cur_group = $db->fetch_assoc($result))
|
||||
{
|
||||
$read_forum_new = ($cur_group['g_read_board'] == '1') ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? '1' : '0' : intval($_POST['read_forum_old'][$cur_group['g_id']]);
|
||||
$post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? '1' : '0';
|
||||
$post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? '1' : '0';
|
||||
|
||||
// Check if the new settings differ from the old
|
||||
if ($read_forum_new != $_POST['read_forum_old'][$cur_group['g_id']] || $post_replies_new != $_POST['post_replies_old'][$cur_group['g_id']] || $post_topics_new != $_POST['post_topics_old'][$cur_group['g_id']])
|
||||
{
|
||||
// If the new settings are identical to the default settings for this group, delete its row in forum_perms
|
||||
if ($read_forum_new == '1' && $post_replies_new == $cur_group['g_post_replies'] && $post_topics_new == $cur_group['g_post_topics'])
|
||||
$db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
|
||||
else
|
||||
{
|
||||
// Run an UPDATE and see if it affected a row, if not, INSERT
|
||||
$db->query('UPDATE '.$db->prefix.'forum_perms SET read_forum='.$read_forum_new.', post_replies='.$post_replies_new.', post_topics='.$post_topics_new.' WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
|
||||
if (!$db->affected_rows())
|
||||
$db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$cur_group['g_id'].', '.$forum_id.', '.$read_forum_new.', '.$post_replies_new.', '.$post_topics_new.')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_subforums_cache(); // MOD subforums - Visman
|
||||
generate_quickjump_cache();
|
||||
|
||||
redirect('admin_forums.php', $lang_admin_forums['Forum updated redirect']);
|
||||
}
|
||||
else if (isset($_POST['revert_perms']))
|
||||
{
|
||||
confirm_referrer('admin_forums.php');
|
||||
|
||||
$db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_subforums_cache(); // MOD subforums - Visman
|
||||
generate_quickjump_cache();
|
||||
|
||||
redirect('admin_forums.php?edit_forum='.$forum_id, $lang_admin_forums['Perms reverted redirect']);
|
||||
}
|
||||
|
||||
// Fetch forum info
|
||||
$result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id, parent_forum_id FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); // MOD subforums - Visman
|
||||
if (!$db->num_rows($result))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$cur_forum = $db->fetch_assoc($result);
|
||||
|
||||
// MOD subforums - Visman
|
||||
if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/subforums.php'))
|
||||
require PUN_ROOT.'lang/'.$pun_user['language'].'/subforums.php';
|
||||
else
|
||||
require PUN_ROOT.'lang/English/subforums.php';
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('forums');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_forums['Edit forum head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="edit_forum" method="post" action="admin_forums.php?edit_forum=<?php echo $forum_id ?>">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" tabindex="6" /></p>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_forums['Edit details subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_forums['Forum name label'] ?></th>
|
||||
<td><input type="text" name="forum_name" size="35" maxlength="80" value="<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?>" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_forums['Forum description label'] ?></th>
|
||||
<td><textarea name="forum_desc" rows="3" cols="50" tabindex="2"><?php echo pun_htmlspecialchars($cur_forum['forum_desc']) ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_forums['Category label'] ?></th>
|
||||
<td>
|
||||
<select name="cat_id" tabindex="3">
|
||||
<?php
|
||||
|
||||
$result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
|
||||
while ($cur_cat = $db->fetch_assoc($result))
|
||||
{
|
||||
$selected = ($cur_cat['id'] == $cur_forum['cat_id']) ? ' selected="selected"' : '';
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'"'.$selected.'>'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_forums['Sort by label'] ?></th>
|
||||
<td>
|
||||
<select name="sort_by" tabindex="4">
|
||||
<option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Last post'] ?></option>
|
||||
<option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Topic start'] ?></option>
|
||||
<option value="2"<?php if ($cur_forum['sort_by'] == '2') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Subject'] ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_forums['Redirect label'] ?></th>
|
||||
<td><?php echo ($cur_forum['num_topics']) ? $lang_admin_forums['Redirect help'] : '<input type="text" name="redirect_url" size="45" maxlength="100" value="'.pun_htmlspecialchars($cur_forum['redirect_url']).'" tabindex="5" />'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_subforums['Parent forum'] ?></th>
|
||||
<td>
|
||||
<select name="parent_forum">
|
||||
<option value="0"><?php echo $lang_subforums['No parent forum'] ?></option>
|
||||
<?php
|
||||
// MOD subforums - Visman
|
||||
function sf_select_view ($id, $cur_forum, $space = '')
|
||||
{
|
||||
global $sf_array_tree, $sf_array_asc;
|
||||
|
||||
if (empty($sf_array_tree[$id])) return;
|
||||
$cur_category = 0;
|
||||
foreach ($sf_array_tree[$id] as $forum_list)
|
||||
{
|
||||
if ($id == 0 && $forum_list['cid'] != $cur_category)
|
||||
{
|
||||
if ($cur_category)
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n";
|
||||
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum_list['cat_name']).'">'."\n";
|
||||
$cur_category = $forum_list['cid'];
|
||||
}
|
||||
|
||||
$selected = ($forum_list['fid'] == $cur_forum['parent_forum_id']) ? ' selected="selected"' : '';
|
||||
$disabled = ($forum_list['fid'] == $cur_forum['id'] || (isset($sf_array_asc[$cur_forum['id']]) && in_array($forum_list['fid'], $sf_array_asc[$cur_forum['id']]))) ? ' disabled="disabled"' : '';
|
||||
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$forum_list['fid'].'"'.$selected.$disabled.'>'.$space.pun_htmlspecialchars($forum_list['forum_name']).'</option>'."\n";
|
||||
sf_select_view ($forum_list['fid'], $cur_forum, $space.'  ');
|
||||
}
|
||||
}
|
||||
|
||||
sf_select_view (0, $cur_forum);
|
||||
?>
|
||||
</optgroup>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_forums['Group permissions subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php printf($lang_admin_forums['Group permissions info'], '<a href="admin_groups.php">'.$lang_admin_common['User groups'].'</a>') ?></p>
|
||||
<table id="forumperms">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="atcl"> </th>
|
||||
<th><?php echo $lang_admin_forums['Read forum label'] ?></th>
|
||||
<th><?php echo $lang_admin_forums['Post replies label'] ?></th>
|
||||
<th><?php echo $lang_admin_forums['Post topics label'] ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$result = $db->query('SELECT g.g_id, g.g_title, g.g_read_board, g.g_post_replies, g.g_post_topics, fp.read_forum, fp.post_replies, fp.post_topics FROM '.$db->prefix.'groups AS g LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (g.g_id=fp.group_id AND fp.forum_id='.$forum_id.') WHERE g.g_id!='.PUN_ADMIN.' ORDER BY g.g_id') or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$cur_index = 7;
|
||||
|
||||
while ($cur_perm = $db->fetch_assoc($result))
|
||||
{
|
||||
$read_forum = ($cur_perm['read_forum'] != '0') ? true : false;
|
||||
$post_replies = (($cur_perm['g_post_replies'] == '0' && $cur_perm['post_replies'] == '1') || ($cur_perm['g_post_replies'] == '1' && $cur_perm['post_replies'] != '0')) ? true : false;
|
||||
$post_topics = (($cur_perm['g_post_topics'] == '0' && $cur_perm['post_topics'] == '1') || ($cur_perm['g_post_topics'] == '1' && $cur_perm['post_topics'] != '0')) ? true : false;
|
||||
|
||||
// Determine if the current settings differ from the default or not
|
||||
$read_forum_def = ($cur_perm['read_forum'] == '0') ? false : true;
|
||||
$post_replies_def = (($post_replies && $cur_perm['g_post_replies'] == '0') || (!$post_replies && ($cur_perm['g_post_replies'] == '' || $cur_perm['g_post_replies'] == '1'))) ? false : true;
|
||||
$post_topics_def = (($post_topics && $cur_perm['g_post_topics'] == '0') || (!$post_topics && ($cur_perm['g_post_topics'] == '' || $cur_perm['g_post_topics'] == '1'))) ? false : true;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th class="atcl"><?php echo pun_htmlspecialchars($cur_perm['g_title']) ?></th>
|
||||
<td<?php if (!$read_forum_def) echo ' class="nodefault"'; ?>>
|
||||
<input type="hidden" name="read_forum_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($read_forum) ? '1' : '0'; ?>" />
|
||||
<input type="checkbox" name="read_forum_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($read_forum) ? ' checked="checked"' : ''; ?><?php echo ($cur_perm['g_read_board'] == '0') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
|
||||
</td>
|
||||
<td<?php if (!$post_replies_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>>
|
||||
<input type="hidden" name="post_replies_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($post_replies) ? '1' : '0'; ?>" />
|
||||
<input type="checkbox" name="post_replies_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_replies) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
|
||||
</td>
|
||||
<td<?php if (!$post_topics_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>>
|
||||
<input type="hidden" name="post_topics_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($post_topics) ? '1' : '0'; ?>" />
|
||||
<input type="checkbox" name="post_topics_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_topics) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="fsetsubmit"><input type="submit" name="revert_perms" value="<?php echo $lang_admin_forums['Revert to default'] ?>" tabindex="<?php echo $cur_index++ ?>" /></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="submitend"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" tabindex="<?php echo $cur_index++ ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('forums');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_forums['Add forum head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_forums.php?action=adddel">
|
||||
<?php
|
||||
|
||||
$result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
|
||||
|
||||
if ($db->num_rows($result) > 0)
|
||||
{
|
||||
|
||||
?>
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_forums['Create new subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_forums['Add forum label'] ?><div><input type="submit" name="add_forum" value="<?php echo $lang_admin_forums['Add forum'] ?>" tabindex="2" /></div></th>
|
||||
<td>
|
||||
<select name="add_to_cat" tabindex="1">
|
||||
<?php
|
||||
|
||||
while ($cur_cat = $db->fetch_assoc($result))
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n";
|
||||
|
||||
?>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_forums['Add forum help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_common['None'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php echo $lang_admin_forums['No categories exist'] ?></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
// Display all the categories and forums
|
||||
//$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.disp_position FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
|
||||
|
||||
//if ($db->num_rows($result) > 0)
|
||||
if (!empty($sf_array_tree[0])) // MOD subforums - Visman
|
||||
{
|
||||
|
||||
?>
|
||||
<h2 class="block2"><span><?php echo $lang_admin_forums['Edit forums head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="edforum" method="post" action="admin_forums.php?action=edit">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<p class="submittop"><input type="submit" name="update_positions" value="<?php echo $lang_admin_forums['Update positions'] ?>" tabindex="3" /></p>
|
||||
<?php
|
||||
|
||||
$cur_index = 4;
|
||||
|
||||
// MOD subforum - Visman
|
||||
function sf_list_view ($id, $space = '')
|
||||
{
|
||||
global $sf_array_tree, $cur_index, $lang_admin_common, $lang_admin_forums;
|
||||
|
||||
if (empty($sf_array_tree[$id])) return;
|
||||
$cur_category = 0;
|
||||
foreach ($sf_array_tree[$id] as $cur_forum)
|
||||
{
|
||||
if ($id == 0 && $cur_forum['cid'] != $cur_category)
|
||||
{
|
||||
if ($cur_category)
|
||||
echo "\t\t\t\t\t\t\t".'</tbody>'."\n\t\t\t\t\t\t\t".'</table>'."\n\t\t\t\t\t\t".'</div>'."\n\t\t\t\t\t".'</fieldset>'."\n\t\t\t\t".'</div>'."\n";
|
||||
|
||||
?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_forums['Category subhead'] ?> <?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></legend>
|
||||
<div class="infldset">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tcl"><?php echo $lang_admin_common['Action'] ?></th>
|
||||
<th class="tc2"><?php echo $lang_admin_forums['Position label'] ?></th>
|
||||
<th class="tcr"><?php echo $lang_admin_forums['Forum label'] ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$cur_category = $cur_forum['cid'];
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="tcl"><a href="admin_forums.php?edit_forum=<?php echo $cur_forum['fid'] ?>&csrf_hash=<?php echo csrf_hash() ?>" tabindex="<?php echo $cur_index++ ?>"><?php echo $lang_admin_forums['Edit link'] ?></a> | <a href="admin_forums.php?del_forum=<?php echo $cur_forum['fid'] ?>&csrf_hash=<?php echo csrf_hash() ?>" tabindex="<?php echo $cur_index++ ?>"><?php echo $lang_admin_forums['Delete link'] ?></a></td>
|
||||
<td class="tc2"><input type="text" name="position[<?php echo $cur_forum['fid'] ?>]" size="3" maxlength="3" value="<?php echo $cur_forum['disp_position'] ?>" tabindex="<?php echo $cur_index++ ?>" /></td>
|
||||
<td class="tcr"><strong><?php echo $space.pun_htmlspecialchars($cur_forum['forum_name']) ?></strong></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
sf_list_view ($cur_forum['fid'], $space.'   ');
|
||||
}
|
||||
}
|
||||
|
||||
sf_list_view (0);
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="submitend"><input type="submit" name="update_positions" value="<?php echo $lang_admin_forums['Update positions'] ?>" tabindex="<?php echo $cur_index++ ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
649
admin_groups.php
Normal file
|
@ -0,0 +1,649 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_censoring.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_groups.php';
|
||||
|
||||
|
||||
// Fetch all groups
|
||||
$result = $db->query('SELECT * FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user groups', __FILE__, __LINE__, $db->error());
|
||||
$groups = array();
|
||||
while ($cur_group = $db->fetch_assoc($result))
|
||||
$groups[$cur_group['g_id']] = $cur_group;
|
||||
|
||||
// Add/edit a group (stage 1)
|
||||
if (isset($_POST['add_group']) || isset($_GET['edit_group']))
|
||||
{
|
||||
if (isset($_POST['add_group']))
|
||||
{
|
||||
$base_group = intval($_POST['base_group']);
|
||||
$group = $groups[$base_group];
|
||||
|
||||
$mode = 'add';
|
||||
}
|
||||
else // We are editing a group
|
||||
{
|
||||
$group_id = intval($_GET['edit_group']);
|
||||
if ($group_id < 1 || !isset($groups[$group_id]))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$group = $groups[$group_id];
|
||||
|
||||
$mode = 'edit';
|
||||
}
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']);
|
||||
$required_fields = array('req_title' => $lang_admin_groups['Group title label']);
|
||||
$focus_element = array('groups2', 'req_title');
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('groups');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_groups['Group settings head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="groups2" method="post" action="admin_groups.php" onsubmit="return process_form(this)">
|
||||
<p class="submittop"><input type="submit" name="add_edit_group" value="<?php echo $lang_admin_common['Save'] ?>" /></p>
|
||||
<div class="inform">
|
||||
<input type="hidden" name="mode" value="<?php echo $mode ?>" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<?php if ($mode == 'edit'): ?> <input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
|
||||
<?php endif; ?><?php if ($mode == 'add'): ?> <input type="hidden" name="base_group" value="<?php echo $base_group ?>" />
|
||||
<?php endif; ?> <fieldset>
|
||||
<legend><?php echo $lang_admin_groups['Group settings subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php echo $lang_admin_groups['Group settings info'] ?></p>
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Group title label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="req_title" size="25" maxlength="50" value="<?php if ($mode == 'edit') echo pun_htmlspecialchars($group['g_title']); ?>" tabindex="1" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['User title label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="user_title" size="25" maxlength="50" value="<?php echo pun_htmlspecialchars($group['g_user_title']) ?>" tabindex="2" />
|
||||
<span><?php printf($lang_admin_groups['User title help'], ($group['g_id'] != PUN_GUEST ? $lang_common['Member'] : $lang_common['Guest'])) ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($group['g_id'] != PUN_ADMIN): if ($group['g_id'] != PUN_GUEST): ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Promote users label'] ?></th>
|
||||
<td>
|
||||
<select name="promote_next_group" tabindex="3">
|
||||
<option value="0"><?php echo $lang_admin_groups['Disable promotion'] ?></option>
|
||||
<?php
|
||||
|
||||
foreach ($groups as $cur_group)
|
||||
{
|
||||
if (($cur_group['g_id'] != $group['g_id'] || $mode == 'add') && $cur_group['g_id'] != PUN_ADMIN && $cur_group['g_id'] != PUN_GUEST)
|
||||
{
|
||||
if ($cur_group['g_id'] == $group['g_promote_next_group'])
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<input type="text" name="promote_min_posts" size="5" maxlength="10" value="<?php echo pun_htmlspecialchars($group['g_promote_min_posts']) ?>" tabindex="4" />
|
||||
<span><?php printf($lang_admin_groups['Promote users help'], $lang_admin_groups['Disable promotion']) ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($mode != 'edit' || $pun_config['o_default_user_group'] != $group['g_id']): ?> <tr>
|
||||
<th scope="row"> <?php echo $lang_admin_groups['Mod privileges label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="moderator" value="1"<?php if ($group['g_moderator'] == '1') echo ' checked="checked"' ?> tabindex="5" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="moderator" value="0"<?php if ($group['g_moderator'] == '0') echo ' checked="checked"' ?> tabindex="6" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Mod privileges help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Edit profile label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="mod_edit_users" value="1"<?php if ($group['g_mod_edit_users'] == '1') echo ' checked="checked"' ?> tabindex="7" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="mod_edit_users" value="0"<?php if ($group['g_mod_edit_users'] == '0') echo ' checked="checked"' ?> tabindex="8" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Edit profile help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Rename users label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="mod_rename_users" value="1"<?php if ($group['g_mod_rename_users'] == '1') echo ' checked="checked"' ?> tabindex="9" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="mod_rename_users" value="0"<?php if ($group['g_mod_rename_users'] == '0') echo ' checked="checked"' ?> tabindex="10" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Rename users help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Change passwords label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="mod_change_passwords" value="1"<?php if ($group['g_mod_change_passwords'] == '1') echo ' checked="checked"' ?> tabindex="11" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="mod_change_passwords" value="0"<?php if ($group['g_mod_change_passwords'] == '0') echo ' checked="checked"' ?> tabindex="12" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Change passwords help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Mod promote users label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="mod_promote_users" value="1"<?php if ($group['g_mod_promote_users'] == '1') echo ' checked="checked"' ?> tabindex="13" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="mod_promote_users" value="0"<?php if ($group['g_mod_promote_users'] == '0') echo ' checked="checked"' ?> tabindex="14" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Mod promote users help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Ban users label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="mod_ban_users" value="1"<?php if ($group['g_mod_ban_users'] == '1') echo ' checked="checked"' ?> tabindex="15" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="mod_ban_users" value="0"<?php if ($group['g_mod_ban_users'] == '0') echo ' checked="checked"' ?> tabindex="16" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Ban users help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; endif; ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Read board label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="read_board" value="1"<?php if ($group['g_read_board'] == '1') echo ' checked="checked"' ?> tabindex="17" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="read_board" value="0"<?php if ($group['g_read_board'] == '0') echo ' checked="checked"' ?> tabindex="18" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Read board help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['View user info label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="view_users" value="1"<?php if ($group['g_view_users'] == '1') echo ' checked="checked"' ?> tabindex="19" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="view_users" value="0"<?php if ($group['g_view_users'] == '0') echo ' checked="checked"' ?> tabindex="20" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['View user info help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Post replies label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="post_replies" value="1"<?php if ($group['g_post_replies'] == '1') echo ' checked="checked"' ?> tabindex="21" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="post_replies" value="0"<?php if ($group['g_post_replies'] == '0') echo ' checked="checked"' ?> tabindex="22" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Post replies help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Post topics label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="post_topics" value="1"<?php if ($group['g_post_topics'] == '1') echo ' checked="checked"' ?> tabindex="23" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="post_topics" value="0"<?php if ($group['g_post_topics'] == '0') echo ' checked="checked"' ?> tabindex="24" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Post topics help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($group['g_id'] != PUN_GUEST): ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Edit posts label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="edit_posts" value="1"<?php if ($group['g_edit_posts'] == '1') echo ' checked="checked"' ?> tabindex="25" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="edit_posts" value="0"<?php if ($group['g_edit_posts'] == '0') echo ' checked="checked"' ?> tabindex="26" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Edit posts help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Delete posts label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="delete_posts" value="1"<?php if ($group['g_delete_posts'] == '1') echo ' checked="checked"' ?> tabindex="27" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="delete_posts" value="0"<?php if ($group['g_delete_posts'] == '0') echo ' checked="checked"' ?> tabindex="28" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Delete posts help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Delete topics label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="delete_topics" value="1"<?php if ($group['g_delete_topics'] == '1') echo ' checked="checked"' ?> tabindex="29" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="delete_topics" value="0"<?php if ($group['g_delete_topics'] == '0') echo ' checked="checked"' ?> tabindex="30" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Delete topics help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Post links label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="post_links" value="1"<?php if ($group['g_post_links'] == '1') echo ' checked="checked"' ?> tabindex="31" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="post_links" value="0"<?php if ($group['g_post_links'] == '0') echo ' checked="checked"' ?> tabindex="32" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Post links help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($group['g_id'] != PUN_GUEST): ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Set own title label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="set_title" value="1"<?php if ($group['g_set_title'] == '1') echo ' checked="checked"' ?> tabindex="33" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="set_title" value="0"<?php if ($group['g_set_title'] == '0') echo ' checked="checked"' ?> tabindex="34" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Set own title help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['User search label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="search" value="1"<?php if ($group['g_search'] == '1') echo ' checked="checked"' ?> tabindex="35" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="search" value="0"<?php if ($group['g_search'] == '0') echo ' checked="checked"' ?> tabindex="36" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['User search help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['User list search label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="search_users" value="1"<?php if ($group['g_search_users'] == '1') echo ' checked="checked"' ?> tabindex="37" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="search_users" value="0"<?php if ($group['g_search_users'] == '0') echo ' checked="checked"' ?> tabindex="38" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['User list search help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($group['g_id'] != PUN_GUEST): ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Send e-mails label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="send_email" value="1"<?php if ($group['g_send_email'] == '1') echo ' checked="checked"' ?> tabindex="39" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="send_email" value="0"<?php if ($group['g_send_email'] == '0') echo ' checked="checked"' ?> tabindex="40" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_groups['Send e-mails help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Post flood label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="post_flood" size="5" maxlength="4" value="<?php echo $group['g_post_flood'] ?>" tabindex="41" />
|
||||
<span><?php echo $lang_admin_groups['Post flood help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Search flood label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="search_flood" size="5" maxlength="4" value="<?php echo $group['g_search_flood'] ?>" tabindex="42" />
|
||||
<span><?php echo $lang_admin_groups['Search flood help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($group['g_id'] != PUN_GUEST): ?> <tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['E-mail flood label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="email_flood" size="5" maxlength="4" value="<?php echo $group['g_email_flood'] ?>" tabindex="43" />
|
||||
<span><?php echo $lang_admin_groups['E-mail flood help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Report flood label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="report_flood" size="5" maxlength="4" value="<?php echo $group['g_report_flood'] ?>" tabindex="44" />
|
||||
<span><?php echo $lang_admin_groups['Report flood help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; endif; ?> </table>
|
||||
<?php if ($group['g_moderator'] == '1' ): ?> <p class="warntext"><?php echo $lang_admin_groups['Moderator info'] ?></p>
|
||||
<?php endif; ?> </div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="submitend"><input type="submit" name="add_edit_group" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="45" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
|
||||
|
||||
// Add/edit a group (stage 2)
|
||||
else if (isset($_POST['add_edit_group']))
|
||||
{
|
||||
confirm_referrer('admin_groups.php');
|
||||
|
||||
// Is this the admin group? (special rules apply)
|
||||
$is_admin_group = (isset($_POST['group_id']) && $_POST['group_id'] == PUN_ADMIN) ? true : false;
|
||||
|
||||
$title = pun_trim($_POST['req_title']);
|
||||
$user_title = pun_trim($_POST['user_title']);
|
||||
|
||||
$promote_min_posts = isset($_POST['promote_min_posts']) ? intval($_POST['promote_min_posts']) : '0';
|
||||
if (isset($_POST['promote_next_group']) &&
|
||||
isset($groups[$_POST['promote_next_group']]) &&
|
||||
!in_array($_POST['promote_next_group'], array(PUN_ADMIN, PUN_GUEST)) &&
|
||||
(!isset($_POST['group_id']) || $_POST['promote_next_group'] != $_POST['group_id']))
|
||||
$promote_next_group = $_POST['promote_next_group'];
|
||||
else
|
||||
$promote_next_group = '0';
|
||||
|
||||
$moderator = isset($_POST['moderator']) && $_POST['moderator'] == '1' ? '1' : '0';
|
||||
$mod_edit_users = $moderator == '1' && isset($_POST['mod_edit_users']) && $_POST['mod_edit_users'] == '1' ? '1' : '0';
|
||||
$mod_rename_users = $moderator == '1' && isset($_POST['mod_rename_users']) && $_POST['mod_rename_users'] == '1' ? '1' : '0';
|
||||
$mod_change_passwords = $moderator == '1' && isset($_POST['mod_change_passwords']) && $_POST['mod_change_passwords'] == '1' ? '1' : '0';
|
||||
$mod_ban_users = $moderator == '1' && isset($_POST['mod_ban_users']) && $_POST['mod_ban_users'] == '1' ? '1' : '0';
|
||||
$mod_promote_users = $moderator == '1' && isset($_POST['mod_promote_users']) && $_POST['mod_promote_users'] == '1' ? '1' : '0';
|
||||
$read_board = isset($_POST['read_board']) ? intval($_POST['read_board']) : '1';
|
||||
$view_users = (isset($_POST['view_users']) && $_POST['view_users'] == '1') || $is_admin_group ? '1' : '0';
|
||||
$post_replies = isset($_POST['post_replies']) ? intval($_POST['post_replies']) : '1';
|
||||
$post_topics = isset($_POST['post_topics']) ? intval($_POST['post_topics']) : '1';
|
||||
$edit_posts = isset($_POST['edit_posts']) ? intval($_POST['edit_posts']) : ($is_admin_group) ? '1' : '0';
|
||||
$delete_posts = isset($_POST['delete_posts']) ? intval($_POST['delete_posts']) : ($is_admin_group) ? '1' : '0';
|
||||
$delete_topics = isset($_POST['delete_topics']) ? intval($_POST['delete_topics']) : ($is_admin_group) ? '1' : '0';
|
||||
$post_links = isset($_POST['post_links']) ? intval($_POST['post_links']) : '1';
|
||||
$set_title = isset($_POST['set_title']) ? intval($_POST['set_title']) : ($is_admin_group) ? '1' : '0';
|
||||
$search = isset($_POST['search']) ? intval($_POST['search']) : '1';
|
||||
$search_users = isset($_POST['search_users']) ? intval($_POST['search_users']) : '1';
|
||||
$send_email = (isset($_POST['send_email']) && $_POST['send_email'] == '1') || $is_admin_group ? '1' : '0';
|
||||
$post_flood = (isset($_POST['post_flood']) && $_POST['post_flood'] >= 0) ? intval($_POST['post_flood']) : '0';
|
||||
$search_flood = (isset($_POST['search_flood']) && $_POST['search_flood'] >= 0) ? intval($_POST['search_flood']) : '0';
|
||||
$email_flood = (isset($_POST['email_flood']) && $_POST['email_flood'] >= 0) ? intval($_POST['email_flood']) : '0';
|
||||
$report_flood = (isset($_POST['report_flood']) && $_POST['report_flood'] >= 0) ? intval($_POST['report_flood']) : '0';
|
||||
|
||||
if ($title == '')
|
||||
message($lang_admin_groups['Must enter title message']);
|
||||
|
||||
$user_title = ($user_title != '') ? '\''.$db->escape($user_title).'\'' : 'NULL';
|
||||
|
||||
if ($_POST['mode'] == 'add')
|
||||
{
|
||||
$result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\'') or error('Unable to check group title collision', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title)));
|
||||
|
||||
$db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_promote_min_posts, g_promote_next_group, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_mod_promote_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_post_links, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$promote_min_posts.', '.$promote_next_group.', '.$moderator.', '.$mod_edit_users.', '.$mod_rename_users.', '.$mod_change_passwords.', '.$mod_ban_users.', '.$mod_promote_users.', '.$read_board.', '.$view_users.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$post_links.', '.$set_title.', '.$search.', '.$search_users.', '.$send_email.', '.$post_flood.', '.$search_flood.', '.$email_flood.', '.$report_flood.')') or error('Unable to add group', __FILE__, __LINE__, $db->error());
|
||||
$new_group_id = $db->insert_id();
|
||||
|
||||
// Now lets copy the forum specific permissions from the group which this group is based on
|
||||
$result = $db->query('SELECT forum_id, read_forum, post_replies, post_topics FROM '.$db->prefix.'forum_perms WHERE group_id='.intval($_POST['base_group'])) or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error());
|
||||
while ($cur_forum_perm = $db->fetch_assoc($result))
|
||||
$db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\' AND g_id!='.intval($_POST['group_id'])) or error('Unable to check group title collision', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
message(sprintf($lang_admin_groups['Title already exists message'], pun_htmlspecialchars($title)));
|
||||
|
||||
$db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_promote_min_posts='.$promote_min_posts.', g_promote_next_group='.$promote_next_group.', g_moderator='.$moderator.', g_mod_edit_users='.$mod_edit_users.', g_mod_rename_users='.$mod_rename_users.', g_mod_change_passwords='.$mod_change_passwords.', g_mod_ban_users='.$mod_ban_users.', g_mod_promote_users='.$mod_promote_users.', g_read_board='.$read_board.', g_view_users='.$view_users.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_post_links='.$post_links.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_send_email='.$send_email.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.', g_email_flood='.$email_flood.', g_report_flood='.$report_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Promote all users who would be promoted to this group on their next post
|
||||
if ($promote_next_group)
|
||||
$db->query('UPDATE '.$db->prefix.'users SET group_id = '.$promote_next_group.' WHERE group_id = '.intval($_POST['group_id']).' AND num_posts >= '.$promote_min_posts) or error('Unable to auto-promote existing users', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
// Regenerate the quick jump cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
$group_id = $_POST['mode'] == 'add' ? $new_group_id : intval($_POST['group_id']);
|
||||
generate_quickjump_cache($group_id);
|
||||
|
||||
if ($_POST['mode'] == 'edit')
|
||||
redirect('admin_groups.php', $lang_admin_groups['Group edited redirect']);
|
||||
else
|
||||
redirect('admin_groups.php', $lang_admin_groups['Group added redirect']);
|
||||
}
|
||||
|
||||
|
||||
// Set default group
|
||||
else if (isset($_POST['set_default_group']))
|
||||
{
|
||||
confirm_referrer('admin_groups.php');
|
||||
|
||||
$group_id = intval($_POST['default_group']);
|
||||
|
||||
// Make sure it's not the admin or guest groups
|
||||
if ($group_id == PUN_ADMIN || $group_id == PUN_GUEST)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
// Make sure it's not a moderator group
|
||||
if ($groups[$group_id]['g_moderator'] != 0)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$db->query('UPDATE '.$db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Regenerate the config cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_config_cache();
|
||||
|
||||
redirect('admin_groups.php', $lang_admin_groups['Default group redirect']);
|
||||
}
|
||||
|
||||
|
||||
// Remove a group
|
||||
else if (isset($_GET['del_group']))
|
||||
{
|
||||
confirm_referrer('admin_groups.php');
|
||||
|
||||
$group_id = isset($_POST['group_to_delete']) ? intval($_POST['group_to_delete']) : intval($_GET['del_group']);
|
||||
if ($group_id < 5)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
// Make sure we don't remove the default group
|
||||
if ($group_id == $pun_config['o_default_user_group'])
|
||||
message($lang_admin_groups['Cannot remove default message']);
|
||||
|
||||
// Check if this group has any members
|
||||
$result = $db->query('SELECT g.g_title, COUNT(u.id) FROM '.$db->prefix.'groups AS g INNER JOIN '.$db->prefix.'users AS u ON g.g_id=u.group_id WHERE g.g_id='.$group_id.' GROUP BY g.g_id, g_title') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// If the group doesn't have any members or if we've already selected a group to move the members to
|
||||
if (!$db->num_rows($result) || isset($_POST['del_group']))
|
||||
{
|
||||
if (isset($_POST['del_group_comply']) || isset($_POST['del_group']))
|
||||
{
|
||||
if (isset($_POST['del_group']))
|
||||
{
|
||||
$move_to_group = intval($_POST['move_to_group']);
|
||||
$db->query('UPDATE '.$db->prefix.'users SET group_id='.$move_to_group.' WHERE group_id='.$group_id) or error('Unable to move users into group', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
// Delete the group and any forum specific permissions
|
||||
$db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error());
|
||||
$db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Don't let users be promoted to this group
|
||||
$db->query('UPDATE '.$db->prefix.'groups SET g_promote_next_group=0 WHERE g_promote_next_group='.$group_id) or error('Unable to remove group as promotion target', __FILE__, __LINE__, $db->error());
|
||||
|
||||
redirect('admin_groups.php', $lang_admin_groups['Group removed redirect']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query('SELECT g_title FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch group title', __FILE__, __LINE__, $db->error());
|
||||
$group_title = $db->result($result);
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('groups');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_groups['Group delete head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_groups.php?del_group=<?php echo $group_id ?>">
|
||||
<div class="inform">
|
||||
<input type="hidden" name="group_to_delete" value="<?php echo $group_id ?>" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_groups['Confirm delete subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php printf($lang_admin_groups['Confirm delete info'], pun_htmlspecialchars($group_title)) ?></p>
|
||||
<p class="warntext"><?php echo $lang_admin_groups['Confirm delete warn'] ?></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="buttons"><input type="submit" name="del_group_comply" value="<?php echo $lang_admin_common['Delete'] ?>" tabindex="1" /><a href="javascript:history.go(-1)" tabindex="2"><?php echo $lang_admin_common['Go back'] ?></a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
}
|
||||
|
||||
list($group_title, $group_members) = $db->fetch_row($result);
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('groups');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_groups['Delete group head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="groups" method="post" action="admin_groups.php?del_group=<?php echo $group_id ?>">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_groups['Move users subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php printf($lang_admin_groups['Move users info'], pun_htmlspecialchars($group_title), forum_number_format($group_members)) ?></p>
|
||||
<label><?php echo $lang_admin_groups['Move users label'] ?>
|
||||
<select name="move_to_group">
|
||||
<?php
|
||||
|
||||
$result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' AND g_id!='.$group_id.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
|
||||
|
||||
while ($cur_group = $db->fetch_assoc($result))
|
||||
{
|
||||
if ($cur_group['g_id'] == PUN_MEMBER) // Pre-select the pre-defined Members group
|
||||
echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<br /></label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="buttons"><input type="submit" name="del_group" value="<?php echo $lang_admin_groups['Delete group'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
}
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['User groups']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('groups');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_groups['Add groups head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="groups" method="post" action="admin_groups.php">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_groups['Add group subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['New group label'] ?><div><input type="submit" name="add_group" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="2" /></div></th>
|
||||
<td>
|
||||
<select id="base_group" name="base_group" tabindex="1">
|
||||
<?php
|
||||
|
||||
foreach ($groups as $cur_group)
|
||||
{
|
||||
if ($cur_group['g_id'] != PUN_ADMIN && $cur_group['g_id'] != PUN_GUEST)
|
||||
{
|
||||
if ($cur_group['g_id'] == $pun_config['o_default_user_group'])
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_groups['New group help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_groups['Default group subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_groups['Default group label'] ?><div><input type="submit" name="set_default_group" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="4" /></div></th>
|
||||
<td>
|
||||
<select id="default_group" name="default_group" tabindex="3">
|
||||
<?php
|
||||
|
||||
foreach ($groups as $cur_group)
|
||||
{
|
||||
if ($cur_group['g_id'] > PUN_GUEST && $cur_group['g_moderator'] == 0)
|
||||
{
|
||||
if ($cur_group['g_id'] == $pun_config['o_default_user_group'])
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_groups['Default group help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h2 class="block2"><span><?php echo $lang_admin_groups['Existing groups head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="fakeform">
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_groups['Edit groups subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php echo $lang_admin_groups['Edit groups info'] ?></p>
|
||||
<table>
|
||||
<?php
|
||||
|
||||
$cur_index = 5;
|
||||
|
||||
foreach ($groups as $cur_group)
|
||||
echo "\t\t\t\t\t\t\t\t".'<tr><th scope="row"><a href="admin_groups.php?edit_group='.$cur_group['g_id'].'" tabindex="'.$cur_index++.'">'.$lang_admin_groups['Edit link'].'</a>'.(($cur_group['g_id'] > PUN_MEMBER) ? ' | <a href="admin_groups.php?del_group='.$cur_group['g_id'].'&csrf_hash='.csrf_hash().'" tabindex="'.$cur_index++.'">'.$lang_admin_groups['Delete link'].'</a>' : '').'</th><td>'.pun_htmlspecialchars($cur_group['g_title']).'</td></tr>'."\n";
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
110
admin_index.php
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if (!$pun_user['is_admmod'])
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_index.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_index.php';
|
||||
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : null;
|
||||
|
||||
// Check for upgrade
|
||||
if ($action == 'check_upgrade')
|
||||
{
|
||||
if (!ini_get('allow_url_fopen'))
|
||||
message($lang_admin_index['fopen disabled message']);
|
||||
|
||||
$latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version'));
|
||||
if (empty($latest_version))
|
||||
message($lang_admin_index['Upgrade check failed message']);
|
||||
|
||||
if (version_compare($pun_config['o_cur_version'], $latest_version, '>='))
|
||||
message($lang_admin_index['Running latest version message']);
|
||||
else
|
||||
message(sprintf($lang_admin_index['New version available message'], '<a href="http://fluxbb.org/">FluxBB.org</a>'));
|
||||
}
|
||||
// Remove install.php
|
||||
else if ($action == 'remove_install_file')
|
||||
{
|
||||
$deleted = @unlink(PUN_ROOT.'install.php');
|
||||
|
||||
if ($deleted)
|
||||
redirect('admin_index.php', $lang_admin_index['Deleted install.php redirect']);
|
||||
else
|
||||
message($lang_admin_index['Delete install.php failed']);
|
||||
}
|
||||
|
||||
$install_file_exists = is_file(PUN_ROOT.'install.php');
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Index']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('index');
|
||||
|
||||
?>
|
||||
<div class="block">
|
||||
<h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2>
|
||||
<div id="adintro" class="box">
|
||||
<div class="inbox">
|
||||
<p><?php echo $lang_admin_index['Welcome to admin'] ?></p>
|
||||
<ul>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 1'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 2'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 3'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 4'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 5'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 6'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 7'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 8'] ?></span></li>
|
||||
<li><span><?php echo $lang_admin_index['Welcome 9'] ?></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($install_file_exists) : ?>
|
||||
<h2 class="block2"><span><?php echo $lang_admin_index['Alerts head'] ?></span></h2>
|
||||
<div id="adalerts" class="box">
|
||||
<p><?php printf($lang_admin_index['Install file exists'], '<a href="admin_index.php?action=remove_install_file">'.$lang_admin_index['Delete install file'].'</a>') ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2 class="block2"><span><?php echo $lang_admin_index['About head'] ?></span></h2>
|
||||
<div id="adstats" class="box">
|
||||
<div class="inbox">
|
||||
<dl>
|
||||
<dt><?php echo $lang_admin_index['FluxBB version label'] ?></dt>
|
||||
<dd>
|
||||
<?php printf($lang_admin_index['FluxBB version data']."\n", $pun_config['o_cur_version'].'.'.$pun_config['o_cur_ver_revision'], '<a href="https://fluxbb.org/forums/viewtopic.php?id=4941">'.$lang_admin_index['Check for upgrade'].'</a>') ?> - <a href="https://github.com/MioVisman/FluxBB_by_Visman">GitHub</a>
|
||||
</dd>
|
||||
<dt><?php echo $lang_admin_index['Server statistics label'] ?></dt>
|
||||
<dd>
|
||||
<a href="admin_statistics.php"><?php echo $lang_admin_index['View server statistics'] ?></a>
|
||||
</dd>
|
||||
<dt><?php echo $lang_admin_index['Support label'] ?></dt>
|
||||
<dd>
|
||||
<a href="http://fluxbb.org/forums/index.php"><?php echo $lang_admin_index['Forum label'] ?></a> - <a href="http://fluxbb.org/community/irc.html"><?php echo $lang_admin_index['IRC label'] ?></a>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
55
admin_loader.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if (!$pun_user['is_admmod'])
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// The plugin to load should be supplied via GET
|
||||
$plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
|
||||
if (!preg_match('%^AM?P_(\w*?)\.php$%iD', $plugin))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
// AP_ == Admins only, AMP_ == admins and moderators
|
||||
$prefix = substr($plugin, 0, strpos($plugin, '_'));
|
||||
if ($pun_user['g_moderator'] == '1' && $prefix == 'AP')
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Make sure the file actually exists
|
||||
if (!file_exists(PUN_ROOT.'plugins/'.$plugin))
|
||||
message(sprintf($lang_admin_common['No plugin message'], $plugin));
|
||||
|
||||
// Construct REQUEST_URI if it isn't set
|
||||
if (!isset($_SERVER['REQUEST_URI']))
|
||||
$_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], str_replace('_', ' ', substr($plugin, strpos($plugin, '_') + 1, -4)));
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
// Attempt to load the plugin. We don't use @ here to suppress error messages,
|
||||
// because if we did and a parse error occurred in the plugin, we would only
|
||||
// get the "blank page of death"
|
||||
include PUN_ROOT.'plugins/'.$plugin;
|
||||
if (!defined('PUN_PLUGIN_LOADED'))
|
||||
message(sprintf($lang_admin_common['Plugin failed message'], $plugin));
|
||||
|
||||
// Output the clearer div
|
||||
?>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
362
admin_maintenance.php
Normal file
|
@ -0,0 +1,362 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
// Tell common.php that we don't want output buffering
|
||||
define('PUN_DISABLE_BUFFERING', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_maintenance.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_maintenance.php';
|
||||
|
||||
$action = isset($_REQUEST['action']) ? pun_trim($_REQUEST['action']) : '';
|
||||
|
||||
if ($action == 'rebuild')
|
||||
{
|
||||
$per_page = isset($_GET['i_per_page']) ? intval($_GET['i_per_page']) : 0;
|
||||
$start_at = isset($_GET['i_start_at']) ? intval($_GET['i_start_at']) : 0;
|
||||
|
||||
// Check per page is > 0
|
||||
if ($per_page < 1)
|
||||
message($lang_admin_maintenance['Posts must be integer message']);
|
||||
|
||||
@set_time_limit(0);
|
||||
|
||||
// If this is the first cycle of posts we empty the search index before we proceed
|
||||
if (isset($_GET['i_empty_index']))
|
||||
{
|
||||
// This is the only potentially "dangerous" thing we can do here, so we check the referer
|
||||
confirm_referrer('admin_maintenance.php');
|
||||
|
||||
$db->truncate_table('search_matches') or error('Unable to empty search index match table', __FILE__, __LINE__, $db->error());
|
||||
$db->truncate_table('search_words') or error('Unable to empty search index words table', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Reset the sequence for the search words (not needed for SQLite)
|
||||
switch ($db_type)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
case 'mysql_innodb':
|
||||
case 'mysqli_innodb':
|
||||
$result = $db->query('ALTER TABLE '.$db->prefix.'search_words auto_increment=1') or error('Unable to update table auto_increment', __FILE__, __LINE__, $db->error());
|
||||
break;
|
||||
|
||||
case 'pgsql';
|
||||
$result = $db->query('SELECT setval(\''.$db->prefix.'search_words_id_seq\', 1, false)') or error('Unable to update sequence', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
}
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_maintenance['Rebuilding search index']);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php echo generate_page_title($page_title) ?></title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font: 12px Verdana, Arial, Helvetica, sans-serif;
|
||||
color: #333333;
|
||||
background-color: #FFFFFF
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1><?php echo $lang_admin_maintenance['Rebuilding index info'] ?></h1>
|
||||
<hr />
|
||||
|
||||
<?php
|
||||
|
||||
$query_str = '';
|
||||
|
||||
require PUN_ROOT.'include/search_idx.php';
|
||||
|
||||
// Fetch posts to process this cycle
|
||||
$result = $db->query('SELECT p.id, p.message, t.subject, t.first_post_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id >= '.$start_at.' ORDER BY p.id ASC LIMIT '.$per_page) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$end_at = 0;
|
||||
while ($cur_item = $db->fetch_assoc($result))
|
||||
{
|
||||
echo '<p><span>'.sprintf($lang_admin_maintenance['Processing post'], $cur_item['id']).'</span></p>'."\n";
|
||||
|
||||
if ($cur_item['id'] == $cur_item['first_post_id'])
|
||||
update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']);
|
||||
else
|
||||
update_search_index('post', $cur_item['id'], $cur_item['message']);
|
||||
|
||||
$end_at = $cur_item['id'];
|
||||
}
|
||||
|
||||
// Check if there is more work to do
|
||||
if ($end_at > 0)
|
||||
{
|
||||
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id > '.$end_at.' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());
|
||||
|
||||
if ($db->num_rows($result) > 0)
|
||||
$query_str = '?action=rebuild&i_per_page='.$per_page.'&i_start_at='.$db->result($result);
|
||||
}
|
||||
|
||||
$db->end_transaction();
|
||||
$db->close();
|
||||
|
||||
exit('<meta http-equiv="refresh" content="0;url=admin_maintenance.php'.$query_str.'" /><hr /><p>'.sprintf($lang_admin_maintenance['Javascript redirect failed'], '<a href="admin_maintenance.php'.$query_str.'">'.$lang_admin_maintenance['Click here'].'</a>').'</p>');
|
||||
}
|
||||
|
||||
if ($action == 'prune')
|
||||
{
|
||||
$prune_from = pun_trim($_POST['prune_from']);
|
||||
$prune_sticky = intval($_POST['prune_sticky']);
|
||||
|
||||
if (isset($_POST['prune_comply']))
|
||||
{
|
||||
confirm_referrer('admin_maintenance.php');
|
||||
|
||||
$prune_days = intval($_POST['prune_days']);
|
||||
$prune_date = ($prune_days) ? 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, $prune_sticky, $prune_date);
|
||||
update_forum($fid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$prune_from = intval($prune_from);
|
||||
prune($prune_from, $prune_sticky, $prune_date);
|
||||
update_forum($prune_from);
|
||||
}
|
||||
|
||||
// Locate any "orphaned redirect topics" and delete them
|
||||
$result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT 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_maintenance.php', $lang_admin_maintenance['Posts pruned redirect']);
|
||||
}
|
||||
|
||||
$prune_days = pun_trim($_POST['req_prune_days']);
|
||||
if ($prune_days == '' || preg_match('%[^0-9]%', $prune_days))
|
||||
message($lang_admin_maintenance['Days must be integer message']);
|
||||
|
||||
$prune_date = time() - ($prune_days * 86400);
|
||||
|
||||
// Concatenate together the query for counting number of topics to prune
|
||||
$sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL';
|
||||
|
||||
if ($prune_sticky == '0')
|
||||
$sql .= ' AND sticky=0';
|
||||
|
||||
if ($prune_from != 'all')
|
||||
{
|
||||
$prune_from = intval($prune_from);
|
||||
$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 = '"'.pun_htmlspecialchars($db->result($result)).'"';
|
||||
}
|
||||
else
|
||||
$forum = $lang_admin_maintenance['All forums'];
|
||||
|
||||
$result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error());
|
||||
$num_topics = $db->result($result);
|
||||
|
||||
if (!$num_topics)
|
||||
message(sprintf($lang_admin_maintenance['No old topics message'], $prune_days));
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('maintenance');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_maintenance['Prune head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_maintenance.php">
|
||||
<div class="inform">
|
||||
<input type="hidden" name="action" value="prune" />
|
||||
<input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" />
|
||||
<input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" />
|
||||
<input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_maintenance['Confirm prune subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php printf($lang_admin_maintenance['Confirm prune info'], $prune_days, $forum, forum_number_format($num_topics)) ?></p>
|
||||
<p class="warntext"><?php echo $lang_admin_maintenance['Confirm prune warn'] ?></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="buttons"><input type="submit" name="prune_comply" value="<?php echo $lang_admin_common['Prune'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Get the first post ID from the db
|
||||
$result = $db->query('SELECT id FROM '.$db->prefix.'posts ORDER BY id ASC LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
$first_id = $db->result($result);
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Maintenance']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('maintenance');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_maintenance['Maintenance head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="get" action="admin_maintenance.php">
|
||||
<div class="inform">
|
||||
<input type="hidden" name="action" value="rebuild" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_maintenance['Rebuild index subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php printf($lang_admin_maintenance['Rebuild index info'], '<a href="admin_options.php#maintenance">'.$lang_admin_common['Maintenance mode'].'</a>') ?></p>
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_maintenance['Posts per cycle label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="i_per_page" size="7" maxlength="7" value="300" tabindex="1" />
|
||||
<span><?php echo $lang_admin_maintenance['Posts per cycle help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_maintenance['Starting post label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="i_start_at" size="7" maxlength="7" value="<?php echo (isset($first_id)) ? $first_id : 0 ?>" tabindex="2" />
|
||||
<span><?php echo $lang_admin_maintenance['Starting post help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_maintenance['Empty index label'] ?></th>
|
||||
<td class="inputadmin">
|
||||
<label><input type="checkbox" name="i_empty_index" value="1" tabindex="3" checked="checked" />  <?php echo $lang_admin_maintenance['Empty index help'] ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="topspace"><?php echo $lang_admin_maintenance['Rebuild completed info'] ?></p>
|
||||
<div class="fsetsubmit"><input type="submit" name="rebuild_index" value="<?php echo $lang_admin_maintenance['Rebuild index'] ?>" tabindex="4" /></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="post" action="admin_maintenance.php" onsubmit="return process_form(this)">
|
||||
<div class="inform">
|
||||
<input type="hidden" name="action" value="prune" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_maintenance['Prune subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_maintenance['Days old label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="5" />
|
||||
<span><?php echo $lang_admin_maintenance['Days old help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_maintenance['Prune sticky label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="prune_sticky" value="1" tabindex="6" checked="checked" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="prune_sticky" value="0" /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_maintenance['Prune sticky help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_maintenance['Prune from label'] ?></th>
|
||||
<td>
|
||||
<select name="prune_from" tabindex="7">
|
||||
<option value="all"><?php echo $lang_admin_maintenance['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 WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$cur_category = 0;
|
||||
while ($forum = $db->fetch_assoc($result))
|
||||
{
|
||||
if ($forum['cid'] != $cur_category) // Are we still in the same category?
|
||||
{
|
||||
if ($cur_category)
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n";
|
||||
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n";
|
||||
$cur_category = $forum['cid'];
|
||||
}
|
||||
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.pun_htmlspecialchars($forum['forum_name']).'</option>'."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</optgroup>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_maintenance['Prune from help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="topspace"><?php printf($lang_admin_maintenance['Prune info'], '<a href="admin_options.php#maintenance">'.$lang_admin_common['Maintenance mode'].'</a>') ?></p>
|
||||
<div class="fsetsubmit"><input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="8" /></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
885
admin_options.php
Normal file
|
@ -0,0 +1,885 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_options.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_options.php';
|
||||
|
||||
if (isset($_POST['form_sent']))
|
||||
{
|
||||
confirm_referrer('admin_options.php', $lang_admin_options['Bad HTTP Referer message']);
|
||||
|
||||
$form = array(
|
||||
'board_title' => pun_trim($_POST['form']['board_title']),
|
||||
'board_desc' => pun_trim($_POST['form']['board_desc']),
|
||||
'base_url' => pun_trim($_POST['form']['base_url']),
|
||||
'default_timezone' => floatval($_POST['form']['default_timezone']),
|
||||
'default_dst' => $_POST['form']['default_dst'] != '1' ? '0' : '1',
|
||||
'default_lang' => pun_trim($_POST['form']['default_lang']),
|
||||
'default_style' => pun_trim($_POST['form']['default_style']),
|
||||
'time_format' => pun_trim($_POST['form']['time_format']),
|
||||
'date_format' => pun_trim($_POST['form']['date_format']),
|
||||
'timeout_visit' => (intval($_POST['form']['timeout_visit']) > 0) ? intval($_POST['form']['timeout_visit']) : 1,
|
||||
'timeout_online' => (intval($_POST['form']['timeout_online']) > 0) ? intval($_POST['form']['timeout_online']) : 1,
|
||||
'redirect_delay' => (intval($_POST['form']['redirect_delay']) >= 0) ? intval($_POST['form']['redirect_delay']) : 0,
|
||||
'show_version' => $_POST['form']['show_version'] != '1' ? '0' : '1',
|
||||
'show_user_info' => $_POST['form']['show_user_info'] != '1' ? '0' : '1',
|
||||
'show_post_count' => $_POST['form']['show_post_count'] != '1' ? '0' : '1',
|
||||
'smilies' => $_POST['form']['smilies'] != '1' ? '0' : '1',
|
||||
'smilies_sig' => $_POST['form']['smilies_sig'] != '1' ? '0' : '1',
|
||||
'make_links' => $_POST['form']['make_links'] != '1' ? '0' : '1',
|
||||
'topic_review' => (intval($_POST['form']['topic_review']) >= 0) ? intval($_POST['form']['topic_review']) : 0,
|
||||
'disp_topics_default' => intval($_POST['form']['disp_topics_default']),
|
||||
'disp_posts_default' => intval($_POST['form']['disp_posts_default']),
|
||||
'indent_num_spaces' => (intval($_POST['form']['indent_num_spaces']) >= 0) ? intval($_POST['form']['indent_num_spaces']) : 0,
|
||||
'quote_depth' => (intval($_POST['form']['quote_depth']) > 0) ? intval($_POST['form']['quote_depth']) : 1,
|
||||
'quickpost' => $_POST['form']['quickpost'] != '1' ? '0' : '1',
|
||||
'users_online' => $_POST['form']['users_online'] != '1' ? '0' : '1',
|
||||
'censoring' => $_POST['form']['censoring'] != '1' ? '0' : '1',
|
||||
'signatures' => $_POST['form']['signatures'] != '1' ? '0' : '1',
|
||||
'show_dot' => $_POST['form']['show_dot'] != '1' ? '0' : '1',
|
||||
'topic_views' => $_POST['form']['topic_views'] != '1' ? '0' : '1',
|
||||
'quickjump' => $_POST['form']['quickjump'] != '1' ? '0' : '1',
|
||||
'gzip' => $_POST['form']['gzip'] != '1' ? '0' : '1',
|
||||
'search_all_forums' => $_POST['form']['search_all_forums'] != '1' ? '0' : '1',
|
||||
'additional_navlinks' => pun_trim($_POST['form']['additional_navlinks']),
|
||||
'feed_type' => intval($_POST['form']['feed_type']),
|
||||
'feed_ttl' => intval($_POST['form']['feed_ttl']),
|
||||
'report_method' => intval($_POST['form']['report_method']),
|
||||
'mailing_list' => pun_trim($_POST['form']['mailing_list']),
|
||||
'avatars' => $_POST['form']['avatars'] != '1' ? '0' : '1',
|
||||
'avatars_dir' => pun_trim($_POST['form']['avatars_dir']),
|
||||
'avatars_width' => (intval($_POST['form']['avatars_width']) > 0) ? intval($_POST['form']['avatars_width']) : 1,
|
||||
'avatars_height' => (intval($_POST['form']['avatars_height']) > 0) ? intval($_POST['form']['avatars_height']) : 1,
|
||||
'avatars_size' => (intval($_POST['form']['avatars_size']) > 0) ? intval($_POST['form']['avatars_size']) : 1,
|
||||
'admin_email' => strtolower(pun_trim($_POST['form']['admin_email'])),
|
||||
'webmaster_email' => strtolower(pun_trim($_POST['form']['webmaster_email'])),
|
||||
'forum_subscriptions' => $_POST['form']['forum_subscriptions'] != '1' ? '0' : '1',
|
||||
'topic_subscriptions' => $_POST['form']['topic_subscriptions'] != '1' ? '0' : '1',
|
||||
'smtp_host' => pun_trim($_POST['form']['smtp_host']),
|
||||
'smtp_user' => pun_trim($_POST['form']['smtp_user']),
|
||||
'smtp_ssl' => $_POST['form']['smtp_ssl'] != '1' ? '0' : '1',
|
||||
'regs_allow' => $_POST['form']['regs_allow'] != '1' ? '0' : '1',
|
||||
'regs_verify' => $_POST['form']['regs_verify'] != '1' ? '0' : '1',
|
||||
'regs_report' => $_POST['form']['regs_report'] != '1' ? '0' : '1',
|
||||
'rules' => $_POST['form']['rules'] != '1' ? '0' : '1',
|
||||
'rules_message' => pun_trim($_POST['form']['rules_message']),
|
||||
'default_email_setting' => intval($_POST['form']['default_email_setting']),
|
||||
'announcement' => $_POST['form']['announcement'] != '1' ? '0' : '1',
|
||||
'announcement_message' => pun_trim($_POST['form']['announcement_message']),
|
||||
'maintenance' => $_POST['form']['maintenance'] != '1' ? '0' : '1',
|
||||
'maintenance_message' => pun_trim($_POST['form']['maintenance_message']),
|
||||
);
|
||||
|
||||
if ($form['board_title'] == '')
|
||||
message($lang_admin_options['Must enter title message']);
|
||||
|
||||
// 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);
|
||||
/**
|
||||
// Convert IDN to Punycode if needed
|
||||
if (preg_match('/[^\x00-\x7F]/', $form['base_url']))
|
||||
{
|
||||
if (!function_exists('idn_to_ascii'))
|
||||
message($lang_admin_options['Base URL problem']);
|
||||
else
|
||||
$form['base_url'] = idn_to_ascii($form['base_url']);
|
||||
}
|
||||
**/
|
||||
$languages = forum_list_langs();
|
||||
if (!in_array($form['default_lang'], $languages))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$styles = forum_list_styles();
|
||||
if (!in_array($form['default_style'], $styles))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if ($form['time_format'] == '')
|
||||
$form['time_format'] = 'H:i:s';
|
||||
|
||||
if ($form['date_format'] == '')
|
||||
$form['date_format'] = 'Y-m-d';
|
||||
|
||||
|
||||
require PUN_ROOT.'include/email.php';
|
||||
|
||||
if (!is_valid_email($form['admin_email']))
|
||||
message($lang_admin_options['Invalid e-mail message']);
|
||||
|
||||
if (!is_valid_email($form['webmaster_email']))
|
||||
message($lang_admin_options['Invalid webmaster e-mail message']);
|
||||
|
||||
if ($form['mailing_list'] != '')
|
||||
$form['mailing_list'] = strtolower(preg_replace('%\s%S', '', $form['mailing_list']));
|
||||
|
||||
// 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['additional_navlinks'] != '')
|
||||
$form['additional_navlinks'] = pun_trim(pun_linebreaks($form['additional_navlinks']));
|
||||
|
||||
// Change or enter a SMTP password
|
||||
if (isset($_POST['form']['smtp_change_pass']))
|
||||
{
|
||||
$smtp_pass1 = isset($_POST['form']['smtp_pass1']) ? pun_trim($_POST['form']['smtp_pass1']) : '';
|
||||
$smtp_pass2 = isset($_POST['form']['smtp_pass2']) ? pun_trim($_POST['form']['smtp_pass2']) : '';
|
||||
|
||||
if ($smtp_pass1 == $smtp_pass2)
|
||||
$form['smtp_pass'] = $smtp_pass1;
|
||||
else
|
||||
message($lang_admin_options['SMTP passwords did not match']);
|
||||
}
|
||||
|
||||
if ($form['announcement_message'] != '')
|
||||
$form['announcement_message'] = pun_linebreaks($form['announcement_message']);
|
||||
else
|
||||
{
|
||||
$form['announcement_message'] = $lang_admin_options['Enter announcement here'];
|
||||
$form['announcement'] = '0';
|
||||
}
|
||||
|
||||
if ($form['rules_message'] != '')
|
||||
$form['rules_message'] = pun_linebreaks($form['rules_message']);
|
||||
else
|
||||
{
|
||||
$form['rules_message'] = $lang_admin_options['Enter rules here'];
|
||||
$form['rules'] = '0';
|
||||
}
|
||||
|
||||
if ($form['maintenance_message'] != '')
|
||||
$form['maintenance_message'] = pun_linebreaks($form['maintenance_message']);
|
||||
else
|
||||
{
|
||||
$form['maintenance_message'] = $lang_admin_options['Default maintenance message'];
|
||||
$form['maintenance'] = '0';
|
||||
}
|
||||
|
||||
// Make sure the number of displayed topics and posts is between 3 and 75
|
||||
if ($form['disp_topics_default'] < 3)
|
||||
$form['disp_topics_default'] = 3;
|
||||
else if ($form['disp_topics_default'] > 75)
|
||||
$form['disp_topics_default'] = 75;
|
||||
|
||||
if ($form['disp_posts_default'] < 3)
|
||||
$form['disp_posts_default'] = 3;
|
||||
else if ($form['disp_posts_default'] > 75)
|
||||
$form['disp_posts_default'] = 75;
|
||||
|
||||
if ($form['feed_type'] < 0 || $form['feed_type'] > 2)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if ($form['feed_ttl'] < 0)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if ($form['report_method'] < 0 || $form['report_method'] > 2)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if ($form['default_email_setting'] < 0 || $form['default_email_setting'] > 2)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if ($form['timeout_online'] >= $form['timeout_visit'])
|
||||
message($lang_admin_options['Timeout error message']);
|
||||
|
||||
foreach ($form as $key => $input)
|
||||
{
|
||||
// Only update values that have changed
|
||||
if (array_key_exists('o_'.$key, $pun_config) && $pun_config['o_'.$key] != $input)
|
||||
{
|
||||
if ($input != '' || is_int($input))
|
||||
$value = '\''.$db->escape($input).'\'';
|
||||
else
|
||||
$value = 'NULL';
|
||||
|
||||
$db->query('UPDATE '.$db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'o_'.$db->escape($key).'\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
}
|
||||
|
||||
// Regenerate the config cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_config_cache();
|
||||
clear_feed_cache();
|
||||
|
||||
redirect('admin_options.php', $lang_admin_options['Options updated redirect']);
|
||||
}
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Options']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('options');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_options['Options head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_options.php">
|
||||
<p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p>
|
||||
<div class="inform">
|
||||
<input type="hidden" name="form_sent" value="1" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Essentials subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Board title label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[board_title]" size="50" maxlength="255" value="<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>" />
|
||||
<span><?php echo $lang_admin_options['Board title help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Board desc label'] ?></th>
|
||||
<td>
|
||||
<textarea name="form[board_desc]" cols="60" rows="3"><?php echo pun_htmlspecialchars($pun_config['o_board_desc']) ?></textarea>
|
||||
<span><?php echo $lang_admin_options['Board desc help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Base URL label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[base_url]" size="50" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_base_url']) ?>" />
|
||||
<span><?php echo $lang_admin_options['Base URL help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Timezone label'] ?></th>
|
||||
<td>
|
||||
<select name="form[default_timezone]">
|
||||
<option value="-12"<?php if ($pun_config['o_default_timezone'] == -12) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-12:00'] ?></option>
|
||||
<option value="-11"<?php if ($pun_config['o_default_timezone'] == -11) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-11:00'] ?></option>
|
||||
<option value="-10"<?php if ($pun_config['o_default_timezone'] == -10) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-10:00'] ?></option>
|
||||
<option value="-9.5"<?php if ($pun_config['o_default_timezone'] == -9.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-09:30'] ?></option>
|
||||
<option value="-9"<?php if ($pun_config['o_default_timezone'] == -9) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-09:00'] ?></option>
|
||||
<option value="-8.5"<?php if ($pun_config['o_default_timezone'] == -8.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-08:30'] ?></option>
|
||||
<option value="-8"<?php if ($pun_config['o_default_timezone'] == -8) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-08:00'] ?></option>
|
||||
<option value="-7"<?php if ($pun_config['o_default_timezone'] == -7) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-07:00'] ?></option>
|
||||
<option value="-6"<?php if ($pun_config['o_default_timezone'] == -6) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-06:00'] ?></option>
|
||||
<option value="-5"<?php if ($pun_config['o_default_timezone'] == -5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-05:00'] ?></option>
|
||||
<option value="-4"<?php if ($pun_config['o_default_timezone'] == -4) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-04:00'] ?></option>
|
||||
<option value="-3.5"<?php if ($pun_config['o_default_timezone'] == -3.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-03:30'] ?></option>
|
||||
<option value="-3"<?php if ($pun_config['o_default_timezone'] == -3) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-03:00'] ?></option>
|
||||
<option value="-2"<?php if ($pun_config['o_default_timezone'] == -2) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-02:00'] ?></option>
|
||||
<option value="-1"<?php if ($pun_config['o_default_timezone'] == -1) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC-01:00'] ?></option>
|
||||
<option value="0"<?php if ($pun_config['o_default_timezone'] == 0) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC'] ?></option>
|
||||
<option value="1"<?php if ($pun_config['o_default_timezone'] == 1) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+01:00'] ?></option>
|
||||
<option value="2"<?php if ($pun_config['o_default_timezone'] == 2) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+02:00'] ?></option>
|
||||
<option value="3"<?php if ($pun_config['o_default_timezone'] == 3) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+03:00'] ?></option>
|
||||
<option value="3.5"<?php if ($pun_config['o_default_timezone'] == 3.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+03:30'] ?></option>
|
||||
<option value="4"<?php if ($pun_config['o_default_timezone'] == 4) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+04:00'] ?></option>
|
||||
<option value="4.5"<?php if ($pun_config['o_default_timezone'] == 4.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+04:30'] ?></option>
|
||||
<option value="5"<?php if ($pun_config['o_default_timezone'] == 5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+05:00'] ?></option>
|
||||
<option value="5.5"<?php if ($pun_config['o_default_timezone'] == 5.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+05:30'] ?></option>
|
||||
<option value="5.75"<?php if ($pun_config['o_default_timezone'] == 5.75) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+05:45'] ?></option>
|
||||
<option value="6"<?php if ($pun_config['o_default_timezone'] == 6) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+06:00'] ?></option>
|
||||
<option value="6.5"<?php if ($pun_config['o_default_timezone'] == 6.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+06:30'] ?></option>
|
||||
<option value="7"<?php if ($pun_config['o_default_timezone'] == 7) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+07:00'] ?></option>
|
||||
<option value="8"<?php if ($pun_config['o_default_timezone'] == 8) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+08:00'] ?></option>
|
||||
<option value="8.75"<?php if ($pun_config['o_default_timezone'] == 8.75) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+08:45'] ?></option>
|
||||
<option value="9"<?php if ($pun_config['o_default_timezone'] == 9) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+09:00'] ?></option>
|
||||
<option value="9.5"<?php if ($pun_config['o_default_timezone'] == 9.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+09:30'] ?></option>
|
||||
<option value="10"<?php if ($pun_config['o_default_timezone'] == 10) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+10:00'] ?></option>
|
||||
<option value="10.5"<?php if ($pun_config['o_default_timezone'] == 10.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+10:30'] ?></option>
|
||||
<option value="11"<?php if ($pun_config['o_default_timezone'] == 11) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+11:00'] ?></option>
|
||||
<option value="11.5"<?php if ($pun_config['o_default_timezone'] == 11.5) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+11:30'] ?></option>
|
||||
<option value="12"<?php if ($pun_config['o_default_timezone'] == 12) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+12:00'] ?></option>
|
||||
<option value="12.75"<?php if ($pun_config['o_default_timezone'] == 12.75) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+12:45'] ?></option>
|
||||
<option value="13"<?php if ($pun_config['o_default_timezone'] == 13) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+13:00'] ?></option>
|
||||
<option value="14"<?php if ($pun_config['o_default_timezone'] == 14) echo ' selected="selected"' ?>><?php echo $lang_admin_options['UTC+14:00'] ?></option>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_options['Timezone help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['DST label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[default_dst]" value="1"<?php if ($pun_config['o_default_dst'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[default_dst]" value="0"<?php if ($pun_config['o_default_dst'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['DST help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Language label'] ?></th>
|
||||
<td>
|
||||
<select name="form[default_lang]">
|
||||
<?php
|
||||
|
||||
$languages = forum_list_langs();
|
||||
|
||||
foreach ($languages as $temp)
|
||||
{
|
||||
if ($pun_config['o_default_lang'] == $temp)
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_options['Language help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Default style label'] ?></th>
|
||||
<td>
|
||||
<select name="form[default_style]">
|
||||
<?php
|
||||
|
||||
$styles = forum_list_styles();
|
||||
|
||||
foreach ($styles as $temp)
|
||||
{
|
||||
if ($pun_config['o_default_style'] == $temp)
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_options['Default style help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600;
|
||||
$timestamp = time() + $diff;
|
||||
|
||||
?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Timeouts subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Time format label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[time_format]" size="25" maxlength="25" value="<?php echo pun_htmlspecialchars($pun_config['o_time_format']) ?>" />
|
||||
<span><?php printf($lang_admin_options['Time format help'], gmdate($pun_config['o_time_format'], $timestamp), '<a href="http://www.php.net/manual/en/function.date.php">'.$lang_admin_options['PHP manual'].'</a>') ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Date format label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[date_format]" size="25" maxlength="25" value="<?php echo pun_htmlspecialchars($pun_config['o_date_format']) ?>" />
|
||||
<span><?php printf($lang_admin_options['Date format help'], gmdate($pun_config['o_date_format'], $timestamp), '<a href="http://www.php.net/manual/en/function.date.php">'.$lang_admin_options['PHP manual'].'</a>') ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Visit timeout label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[timeout_visit]" size="5" maxlength="5" value="<?php echo $pun_config['o_timeout_visit'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Visit timeout help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Online timeout label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[timeout_online]" size="5" maxlength="5" value="<?php echo $pun_config['o_timeout_online'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Online timeout help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Redirect time label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[redirect_delay]" size="3" maxlength="3" value="<?php echo $pun_config['o_redirect_delay'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Redirect time help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Display subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Version number label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[show_version]" value="1"<?php if ($pun_config['o_show_version'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[show_version]" value="0"<?php if ($pun_config['o_show_version'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Version number help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Info in posts label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[show_user_info]" value="1"<?php if ($pun_config['o_show_user_info'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[show_user_info]" value="0"<?php if ($pun_config['o_show_user_info'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Info in posts help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Post count label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[show_post_count]" value="1"<?php if ($pun_config['o_show_post_count'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[show_post_count]" value="0"<?php if ($pun_config['o_show_post_count'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Post count help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Smilies label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[smilies]" value="1"<?php if ($pun_config['o_smilies'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[smilies]" value="0"<?php if ($pun_config['o_smilies'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Smilies help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Smilies sigs label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[smilies_sig]" value="1"<?php if ($pun_config['o_smilies_sig'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[smilies_sig]" value="0"<?php if ($pun_config['o_smilies_sig'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Smilies sigs help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Clickable links label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[make_links]" value="1"<?php if ($pun_config['o_make_links'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[make_links]" value="0"<?php if ($pun_config['o_make_links'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Clickable links help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Topic review label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[topic_review]" size="3" maxlength="3" value="<?php echo $pun_config['o_topic_review'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Topic review help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Topics per page label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[disp_topics_default]" size="3" maxlength="2" value="<?php echo $pun_config['o_disp_topics_default'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Topics per page help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Posts per page label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[disp_posts_default]" size="3" maxlength="2" value="<?php echo $pun_config['o_disp_posts_default'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Posts per page help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Indent label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[indent_num_spaces]" size="3" maxlength="3" value="<?php echo $pun_config['o_indent_num_spaces'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Indent help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Quote depth label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[quote_depth]" size="3" maxlength="3" value="<?php echo $pun_config['o_quote_depth'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Quote depth help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Features subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Quick post label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[quickpost]" value="1"<?php if ($pun_config['o_quickpost'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[quickpost]" value="0"<?php if ($pun_config['o_quickpost'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Quick post help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Users online label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[users_online]" value="1"<?php if ($pun_config['o_users_online'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[users_online]" value="0"<?php if ($pun_config['o_users_online'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Users online help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a name="censoring"></a><?php echo $lang_admin_options['Censor words label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[censoring]" value="1"<?php if ($pun_config['o_censoring'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[censoring]" value="0"<?php if ($pun_config['o_censoring'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php printf($lang_admin_options['Censor words help'], '<a href="admin_censoring.php">'.$lang_admin_common['Censoring'].'</a>') ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a name="signatures"></a><?php echo $lang_admin_options['Signatures label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[signatures]" value="1"<?php if ($pun_config['o_signatures'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[signatures]" value="0"<?php if ($pun_config['o_signatures'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Signatures help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['User has posted label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[show_dot]" value="1"<?php if ($pun_config['o_show_dot'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[show_dot]" value="0"<?php if ($pun_config['o_show_dot'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['User has posted help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Topic views label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[topic_views]" value="1"<?php if ($pun_config['o_topic_views'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[topic_views]" value="0"<?php if ($pun_config['o_topic_views'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Topic views help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Quick jump label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[quickjump]" value="1"<?php if ($pun_config['o_quickjump'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[quickjump]" value="0"<?php if ($pun_config['o_quickjump'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Quick jump help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['GZip label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[gzip]" value="1"<?php if ($pun_config['o_gzip'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[gzip]" value="0"<?php if ($pun_config['o_gzip'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['GZip help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Search all label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[search_all_forums]" value="1"<?php if ($pun_config['o_search_all_forums'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[search_all_forums]" value="0"<?php if ($pun_config['o_search_all_forums'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Search all help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Menu items label'] ?></th>
|
||||
<td>
|
||||
<textarea name="form[additional_navlinks]" rows="3" cols="55"><?php echo pun_htmlspecialchars($pun_config['o_additional_navlinks']) ?></textarea>
|
||||
<span><?php echo $lang_admin_options['Menu items help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Feed subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Default feed label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[feed_type]" value="0"<?php if ($pun_config['o_feed_type'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['None'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[feed_type]" value="1"<?php if ($pun_config['o_feed_type'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['RSS'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[feed_type]" value="2"<?php if ($pun_config['o_feed_type'] == '2') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Atom'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Default feed help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Feed TTL label'] ?></th>
|
||||
<td>
|
||||
<select name="form[feed_ttl]">
|
||||
<option value="0"<?php if ($pun_config['o_feed_ttl'] == '0') echo ' selected="selected"'; ?>><?php echo $lang_admin_options['No cache'] ?></option>
|
||||
<?php
|
||||
|
||||
$times = array(5, 15, 30, 60);
|
||||
|
||||
foreach ($times as $time)
|
||||
echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$time.'"'.($pun_config['o_feed_ttl'] == $time ? ' selected="selected"' : '').'>'.sprintf($lang_admin_options['Minutes'], $time).'</option>'."\n";
|
||||
|
||||
?>
|
||||
</select>
|
||||
<span><?php echo $lang_admin_options['Feed TTL help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Reports subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Reporting method label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[report_method]" value="0"<?php if ($pun_config['o_report_method'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Internal'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[report_method]" value="1"<?php if ($pun_config['o_report_method'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['By e-mail'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[report_method]" value="2"<?php if ($pun_config['o_report_method'] == '2') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_options['Both'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Reporting method help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Mailing list label'] ?></th>
|
||||
<td>
|
||||
<textarea name="form[mailing_list]" rows="5" cols="55"><?php echo pun_htmlspecialchars($pun_config['o_mailing_list']) ?></textarea>
|
||||
<span><?php echo $lang_admin_options['Mailing list help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Avatars subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Use avatars label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[avatars]" value="1"<?php if ($pun_config['o_avatars'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[avatars]" value="0"<?php if ($pun_config['o_avatars'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Use avatars help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Upload directory label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[avatars_dir]" size="35" maxlength="50" value="<?php echo pun_htmlspecialchars($pun_config['o_avatars_dir']) ?>" />
|
||||
<span><?php echo $lang_admin_options['Upload directory help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Max width label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[avatars_width]" size="5" maxlength="5" value="<?php echo $pun_config['o_avatars_width'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Max width help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Max height label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[avatars_height]" size="5" maxlength="5" value="<?php echo $pun_config['o_avatars_height'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Max height help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Max size label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[avatars_size]" size="6" maxlength="6" value="<?php echo $pun_config['o_avatars_size'] ?>" />
|
||||
<span><?php echo $lang_admin_options['Max size help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['E-mail subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Admin e-mail label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[admin_email]" size="50" maxlength="80" value="<?php echo pun_htmlspecialchars($pun_config['o_admin_email']) ?>" />
|
||||
<span><?php echo $lang_admin_options['Admin e-mail help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Webmaster e-mail label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[webmaster_email]" size="50" maxlength="80" value="<?php echo pun_htmlspecialchars($pun_config['o_webmaster_email']) ?>" />
|
||||
<span><?php echo $lang_admin_options['Webmaster e-mail help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Forum subscriptions label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[forum_subscriptions]" value="1"<?php if ($pun_config['o_forum_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[forum_subscriptions]" value="0"<?php if ($pun_config['o_forum_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Forum subscriptions help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Topic subscriptions label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[topic_subscriptions]" value="1"<?php if ($pun_config['o_topic_subscriptions'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[topic_subscriptions]" value="0"<?php if ($pun_config['o_topic_subscriptions'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Topic subscriptions help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['SMTP address label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[smtp_host]" size="30" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_host']) ?>" />
|
||||
<span><?php echo $lang_admin_options['SMTP address help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['SMTP username label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[smtp_user]" size="25" maxlength="50" value="<?php echo pun_htmlspecialchars($pun_config['o_smtp_user']) ?>" />
|
||||
<span><?php echo $lang_admin_options['SMTP username help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['SMTP password label'] ?></th>
|
||||
<td>
|
||||
<label><input type="checkbox" name="form[smtp_change_pass]" value="1" /> <?php echo $lang_admin_options['SMTP change password help'] ?></label>
|
||||
<?php $smtp_pass = !empty($pun_config['o_smtp_pass']) ? random_key(pun_strlen($pun_config['o_smtp_pass']), true) : ''; ?>
|
||||
<input type="password" name="form[smtp_pass1]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" />
|
||||
<input type="password" name="form[smtp_pass2]" size="25" maxlength="50" value="<?php echo $smtp_pass ?>" />
|
||||
<span><?php echo $lang_admin_options['SMTP password help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['SMTP SSL label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[smtp_ssl]" value="1"<?php if ($pun_config['o_smtp_ssl'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[smtp_ssl]" value="0"<?php if ($pun_config['o_smtp_ssl'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['SMTP SSL help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Registration subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Allow new label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[regs_allow]" value="1"<?php if ($pun_config['o_regs_allow'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[regs_allow]" value="0"<?php if ($pun_config['o_regs_allow'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Allow new help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Verify label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[regs_verify]" value="1"<?php if ($pun_config['o_regs_verify'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[regs_verify]" value="0"<?php if ($pun_config['o_regs_verify'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Verify help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Report new label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[regs_report]" value="1"<?php if ($pun_config['o_regs_report'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[regs_report]" value="0"<?php if ($pun_config['o_regs_report'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Report new help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Use rules label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[rules]" value="1"<?php if ($pun_config['o_rules'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[rules]" value="0"<?php if ($pun_config['o_rules'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Use rules help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Rules label'] ?></th>
|
||||
<td>
|
||||
<textarea name="form[rules_message]" rows="10" cols="55"><?php echo pun_htmlspecialchars($pun_config['o_rules_message']) ?></textarea>
|
||||
<span><?php echo $lang_admin_options['Rules help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['E-mail default label'] ?></th>
|
||||
<td>
|
||||
<span><?php echo $lang_admin_options['E-mail default help'] ?></span>
|
||||
<label><input type="radio" name="form[default_email_setting]" id="form_default_email_setting_0" value="0"<?php if ($pun_config['o_default_email_setting'] == '0') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Display e-mail label'] ?></label>
|
||||
<label><input type="radio" name="form[default_email_setting]" id="form_default_email_setting_1" value="1"<?php if ($pun_config['o_default_email_setting'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide allow form label'] ?></label>
|
||||
<label><input type="radio" name="form[default_email_setting]" id="form_default_email_setting_2" value="2"<?php if ($pun_config['o_default_email_setting'] == '2') echo ' checked="checked"' ?> /> <?php echo $lang_admin_options['Hide both label'] ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Announcement subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Display announcement label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[announcement]" value="1"<?php if ($pun_config['o_announcement'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[announcement]" value="0"<?php if ($pun_config['o_announcement'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Display announcement help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Announcement message label'] ?></th>
|
||||
<td>
|
||||
<textarea name="form[announcement_message]" rows="5" cols="55"><?php echo pun_htmlspecialchars($pun_config['o_announcement_message']) ?></textarea>
|
||||
<span><?php echo $lang_admin_options['Announcement message help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_options['Maintenance subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><a name="maintenance"></a><?php echo $lang_admin_options['Maintenance mode label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[maintenance]" value="1"<?php if ($pun_config['o_maintenance'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[maintenance]" value="0"<?php if ($pun_config['o_maintenance'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_options['Maintenance mode help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_options['Maintenance message label'] ?></th>
|
||||
<td>
|
||||
<textarea name="form[maintenance_message]" rows="5" cols="55"><?php echo pun_htmlspecialchars($pun_config['o_maintenance_message']) ?></textarea>
|
||||
<span><?php echo $lang_admin_options['Maintenance message help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="submitend"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
192
admin_permissions.php
Normal file
|
@ -0,0 +1,192 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_permissions.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_permissions.php';
|
||||
|
||||
if (isset($_POST['form_sent']))
|
||||
{
|
||||
confirm_referrer('admin_permissions.php');
|
||||
|
||||
$form = array_map('intval', $_POST['form']);
|
||||
|
||||
foreach ($form as $key => $input)
|
||||
{
|
||||
// Make sure the input is never a negative value
|
||||
if($input < 0)
|
||||
$input = 0;
|
||||
|
||||
// Only update values that have changed
|
||||
if (array_key_exists('p_'.$key, $pun_config) && $pun_config['p_'.$key] != $input)
|
||||
$db->query('UPDATE '.$db->prefix.'config SET conf_value='.$input.' WHERE conf_name=\'p_'.$db->escape($key).'\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
// Regenerate the config cache
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_config_cache();
|
||||
|
||||
redirect('admin_permissions.php', $lang_admin_permissions['Perms updated redirect']);
|
||||
}
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Permissions']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('permissions');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_permissions['Permissions head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_permissions.php">
|
||||
<p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p>
|
||||
<div class="inform">
|
||||
<input type="hidden" name="form_sent" value="1" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_permissions['Posting subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['BBCode label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[message_bbcode]" value="1"<?php if ($pun_config['p_message_bbcode'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[message_bbcode]" value="0"<?php if ($pun_config['p_message_bbcode'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['BBCode help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['Image tag label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[message_img_tag]" value="1"<?php if ($pun_config['p_message_img_tag'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[message_img_tag]" value="0"<?php if ($pun_config['p_message_img_tag'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['Image tag help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['All caps message label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[message_all_caps]" value="1"<?php if ($pun_config['p_message_all_caps'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[message_all_caps]" value="0"<?php if ($pun_config['p_message_all_caps'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['All caps message help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['All caps subject label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[subject_all_caps]" value="1"<?php if ($pun_config['p_subject_all_caps'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[subject_all_caps]" value="0"<?php if ($pun_config['p_subject_all_caps'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['All caps subject help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['Require e-mail label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[force_guest_email]" value="1"<?php if ($pun_config['p_force_guest_email'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[force_guest_email]" value="0"<?php if ($pun_config['p_force_guest_email'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['Require e-mail help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_permissions['Signatures subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['BBCode sigs label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[sig_bbcode]" value="1"<?php if ($pun_config['p_sig_bbcode'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[sig_bbcode]" value="0"<?php if ($pun_config['p_sig_bbcode'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['BBCode sigs help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['Image tag sigs label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[sig_img_tag]" value="1"<?php if ($pun_config['p_sig_img_tag'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[sig_img_tag]" value="0"<?php if ($pun_config['p_sig_img_tag'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['Image tag sigs help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['All caps sigs label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[sig_all_caps]" value="1"<?php if ($pun_config['p_sig_all_caps'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[sig_all_caps]" value="0"<?php if ($pun_config['p_sig_all_caps'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['All caps sigs help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['Max sig length label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[sig_length]" size="5" maxlength="5" value="<?php echo $pun_config['p_sig_length'] ?>" />
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['Max sig length help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['Max sig lines label'] ?></th>
|
||||
<td>
|
||||
<input type="text" name="form[sig_lines]" size="3" maxlength="3" value="<?php echo $pun_config['p_sig_lines'] ?>" />
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['Max sig lines help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_permissions['Registration subhead'] ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['Banned e-mail label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[allow_banned_email]" value="1"<?php if ($pun_config['p_allow_banned_email'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[allow_banned_email]" value="0"<?php if ($pun_config['p_allow_banned_email'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['Banned e-mail help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_permissions['Duplicate e-mail label'] ?></th>
|
||||
<td>
|
||||
<label class="conl"><input type="radio" name="form[allow_dupe_email]" value="1"<?php if ($pun_config['p_allow_dupe_email'] == '1') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['Yes'] ?></strong></label>
|
||||
<label class="conl"><input type="radio" name="form[allow_dupe_email]" value="0"<?php if ($pun_config['p_allow_dupe_email'] == '0') echo ' checked="checked"' ?> /> <strong><?php echo $lang_admin_common['No'] ?></strong></label>
|
||||
<span class="clearb"><?php echo $lang_admin_permissions['Duplicate e-mail help'] ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p class="submitend"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
185
admin_reports.php
Normal file
|
@ -0,0 +1,185 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if (!$pun_user['is_admmod'])
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_reports.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_reports.php';
|
||||
|
||||
// Zap a report
|
||||
if (isset($_POST['zap_id']))
|
||||
{
|
||||
confirm_referrer('admin_reports.php');
|
||||
|
||||
$zap_id = intval(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);
|
||||
|
||||
if ($zapped == '')
|
||||
$db->query('UPDATE '.$db->prefix.'reports SET zapped='.time().', zapped_by='.$pun_user['id'].' WHERE id='.$zap_id) or error('Unable to zap report', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Delete old reports (which cannot be viewed anyway)
|
||||
$result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10,1') or error('Unable to fetch read reports to delete', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result) > 0)
|
||||
{
|
||||
$zapped_threshold = $db->result($result);
|
||||
$db->query('DELETE FROM '.$db->prefix.'reports WHERE zapped <= '.$zapped_threshold) or error('Unable to delete old read reports', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
|
||||
redirect('admin_reports.php', $lang_admin_reports['Report zapped redirect']);
|
||||
}
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Reports']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('reports');
|
||||
|
||||
?>
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_admin_reports['New reports head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="admin_reports.php?action=zap">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<?php
|
||||
|
||||
$result = $db->query('SELECT r.id, r.topic_id, r.forum_id, r.reported_by, r.created, r.message, p.id AS pid, t.subject, f.forum_name, u.username AS reporter FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'posts AS p ON r.post_id=p.id LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT 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'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : $lang_admin_reports['Deleted user'];
|
||||
$forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang_admin_reports['Deleted'].'</span>';
|
||||
$topic = ($cur_report['subject'] != '') ? '<span>» <a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>';
|
||||
$post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message']));
|
||||
$post_id = ($cur_report['pid'] != '') ? '<span>» <a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>';
|
||||
$report_location = array($forum, $topic, $post_id);
|
||||
|
||||
?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php printf($lang_admin_reports['Report subhead'], format_time($cur_report['created'])) ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php printf($lang_admin_reports['Reported by'], $reporter) ?></th>
|
||||
<td class="location"><?php echo implode(' ', $report_location) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_reports['Reason'] ?><div><input type="submit" name="zap_id[<?php echo $cur_report['id'] ?>]" value="<?php echo $lang_admin_reports['Zap'] ?>" /></div></th>
|
||||
<td><?php echo $post ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_common['None'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php echo $lang_admin_reports['No new reports'] ?></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="blockform block2">
|
||||
<h2><span><?php echo $lang_admin_reports['Last 10 head'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="fakeform">
|
||||
<?php
|
||||
|
||||
$result = $db->query('SELECT r.id, r.topic_id, r.forum_id, r.reported_by, r.message, r.zapped, r.zapped_by AS zapped_by_id, p.id AS pid, t.subject, f.forum_name, u.username AS reporter, u2.username AS zapped_by FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'posts AS p ON r.post_id=p.id LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT 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'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : $lang_admin_reports['Deleted user'];
|
||||
$forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang_admin_reports['Deleted'].'</span>';
|
||||
$topic = ($cur_report['subject'] != '') ? '<span>» <a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>';
|
||||
$post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message']));
|
||||
$post_id = ($cur_report['pid'] != '') ? '<span>» <a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.sprintf($lang_admin_reports['Post ID'], $cur_report['pid']).'</a></span>' : '<span>» '.$lang_admin_reports['Deleted'].'</span>';
|
||||
$zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="profile.php?id='.$cur_report['zapped_by_id'].'">'.pun_htmlspecialchars($cur_report['zapped_by']).'</a>' : $lang_admin_reports['NA'];
|
||||
$zapped_by = ($cur_report['zapped_by'] != '') ? '<strong>'.pun_htmlspecialchars($cur_report['zapped_by']).'</strong>' : $lang_admin_reports['NA'];
|
||||
$report_location = array($forum, $topic, $post_id);
|
||||
|
||||
?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php printf($lang_admin_reports['Zapped subhead'], format_time($cur_report['zapped']), $zapped_by) ?></legend>
|
||||
<div class="infldset">
|
||||
<table class="aligntop">
|
||||
<tr>
|
||||
<th scope="row"><?php printf($lang_admin_reports['Reported by'], $reporter) ?></th>
|
||||
<td class="location"><?php echo implode(' ', $report_location) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $lang_admin_reports['Reason'] ?></th>
|
||||
<td><?php echo $post ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
?>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_admin_common['None'] ?></legend>
|
||||
<div class="infldset">
|
||||
<p><?php echo $lang_admin_reports['No zapped reports'] ?></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
139
admin_statistics.php
Normal file
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the admin template
|
||||
define('PUN_ADMIN_CONSOLE', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/common_admin.php';
|
||||
|
||||
|
||||
if (!$pun_user['is_admmod'])
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the admin_index.php language file
|
||||
require PUN_ROOT.'lang/'.$admin_language.'/admin_index.php';
|
||||
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : null;
|
||||
|
||||
|
||||
// Show phpinfo() output
|
||||
if ($action == 'phpinfo' && $pun_user['g_id'] == PUN_ADMIN)
|
||||
{
|
||||
// Is phpinfo() a disabled function?
|
||||
if (strpos(strtolower((string) ini_get('disable_functions')), 'phpinfo') !== false)
|
||||
message($lang_admin_index['PHPinfo disabled message']);
|
||||
|
||||
phpinfo();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Get the server load averages (if possible)
|
||||
if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg'))
|
||||
{
|
||||
// We use @ just in case
|
||||
$fh = @fopen('/proc/loadavg', 'r');
|
||||
$load_averages = @fread($fh, 64);
|
||||
@fclose($fh);
|
||||
|
||||
if (($fh = @fopen('/proc/loadavg', 'r')))
|
||||
{
|
||||
$load_averages = fread($fh, 64);
|
||||
fclose($fh);
|
||||
}
|
||||
else
|
||||
$load_averages = '';
|
||||
|
||||
$load_averages = @explode(' ', $load_averages);
|
||||
$server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : $lang_admin_index['Not available'];
|
||||
}
|
||||
else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match('%averages?: ([0-9\.]+),?\s+([0-9\.]+),?\s+([0-9\.]+)%i', @exec('uptime'), $load_averages))
|
||||
$server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3];
|
||||
else
|
||||
$server_load = $lang_admin_index['Not available'];
|
||||
|
||||
|
||||
// Get number of current visitors
|
||||
$result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error());
|
||||
$num_online = $db->result($result);
|
||||
|
||||
|
||||
// Collect some additional info about MySQL
|
||||
if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
|
||||
{
|
||||
// Calculate total db size/row count
|
||||
$result = $db->query('SHOW TABLE STATUS LIKE \''.$db->prefix.'%\'') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
|
||||
|
||||
$total_records = $total_size = 0;
|
||||
while ($status = $db->fetch_assoc($result))
|
||||
{
|
||||
$total_records += $status['Rows'];
|
||||
$total_size += $status['Data_length'] + $status['Index_length'];
|
||||
}
|
||||
|
||||
$total_size = file_size($total_size);
|
||||
}
|
||||
|
||||
|
||||
// Check for the existence of various PHP opcode caches/optimizers
|
||||
if (function_exists('mmcache'))
|
||||
$php_accelerator = '<a href="http://'.$lang_admin_index['Turck MMCache link'].'">'.$lang_admin_index['Turck MMCache'].'</a>';
|
||||
else if (isset($_PHPA))
|
||||
$php_accelerator = '<a href="http://'.$lang_admin_index['ionCube PHP Accelerator link'].'">'.$lang_admin_index['ionCube PHP Accelerator'].'</a>';
|
||||
else if (ini_get('apc.enabled'))
|
||||
$php_accelerator ='<a href="http://'.$lang_admin_index['Alternative PHP Cache (APC) link'].'">'.$lang_admin_index['Alternative PHP Cache (APC)'].'</a>';
|
||||
else if (ini_get('zend_optimizer.optimization_level'))
|
||||
$php_accelerator = '<a href="http://'.$lang_admin_index['Zend Optimizer link'].'">'.$lang_admin_index['Zend Optimizer'].'</a>';
|
||||
else if (ini_get('eaccelerator.enable'))
|
||||
$php_accelerator = '<a href="http://'.$lang_admin_index['eAccelerator link'].'">'.$lang_admin_index['eAccelerator'].'</a>';
|
||||
else if (ini_get('xcache.cacher'))
|
||||
$php_accelerator = '<a href="http://'.$lang_admin_index['XCache link'].'">'.$lang_admin_index['XCache'].'</a>';
|
||||
else
|
||||
$php_accelerator = $lang_admin_index['NA'];
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Server statistics']);
|
||||
define('PUN_ACTIVE_PAGE', 'admin');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
generate_admin_menu('index');
|
||||
|
||||
?>
|
||||
<div class="block">
|
||||
<h2><span><?php echo $lang_admin_index['Server statistics head'] ?></span></h2>
|
||||
<div id="adstats" class="box">
|
||||
<div class="inbox">
|
||||
<dl>
|
||||
<dt><?php echo $lang_admin_index['Server load label'] ?></dt>
|
||||
<dd>
|
||||
<?php printf($lang_admin_index['Server load data']."\n", $server_load, $num_online) ?>
|
||||
</dd>
|
||||
<?php if ($pun_user['g_id'] == PUN_ADMIN): ?> <dt><?php echo $lang_admin_index['Environment label'] ?></dt>
|
||||
<dd>
|
||||
<?php printf($lang_admin_index['Environment data OS'], PHP_OS) ?><br />
|
||||
<?php printf($lang_admin_index['Environment data version'], phpversion(), '<a href="admin_statistics.php?action=phpinfo">'.$lang_admin_index['Show info'].'</a>') ?><br />
|
||||
<?php printf($lang_admin_index['Environment data acc']."\n", $php_accelerator) ?>
|
||||
</dd>
|
||||
<dt><?php echo $lang_admin_index['Database label'] ?></dt>
|
||||
<dd>
|
||||
<?php echo implode(' ', $db->get_version())."\n" ?>
|
||||
<?php if (isset($total_records) && isset($total_size)): ?> <br /><?php printf($lang_admin_index['Database data rows']."\n", forum_number_format($total_records)) ?>
|
||||
<br /><?php printf($lang_admin_index['Database data size']."\n", $total_size) ?>
|
||||
<?php endif; ?> </dd>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
1123
admin_users.php
Normal file
4
cache/.htaccess
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
<Limit GET POST PUT>
|
||||
Order Allow,Deny
|
||||
Deny from All
|
||||
</Limit>
|
1
cache/index.html
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
2462
db_update.php
Normal file
154
delete.php
Normal file
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
|
||||
|
||||
if ($pun_user['g_read_board'] == '0')
|
||||
message($lang_common['No view'], false, '403 Forbidden');
|
||||
|
||||
|
||||
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
|
||||
if ($id < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
// Fetch some info about the post, the topic and the forum
|
||||
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, f.no_sum_mess, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.first_post_id, t.closed, p.posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); // not sum - f.no_sum_mess, - Visman
|
||||
if (!$db->num_rows($result))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$cur_post = $db->fetch_assoc($result);
|
||||
|
||||
// MOD subforums - Visman
|
||||
if (!isset($sf_array_asc[$cur_post['fid']]))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
if ($pun_config['o_censoring'] == '1')
|
||||
$cur_post['subject'] = censor_words($cur_post['subject']);
|
||||
|
||||
// Sort out who the moderators are and if we are currently a moderator (or an admin)
|
||||
$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array();
|
||||
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
|
||||
|
||||
$is_topic_post = ($id == $cur_post['first_post_id']) ? true : false;
|
||||
|
||||
// Do we have permission to edit this post?
|
||||
if (($pun_user['g_delete_posts'] == '0' ||
|
||||
($pun_user['g_delete_topics'] == '0' && $is_topic_post) ||
|
||||
$cur_post['poster_id'] != $pun_user['id'] ||
|
||||
$cur_post['closed'] == '1') &&
|
||||
!$is_admmod)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
if ($is_admmod && $pun_user['g_id'] != PUN_ADMIN && in_array($cur_post['poster_id'], get_admin_ids()))
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// мод ограничения времени редактирвания - Visman
|
||||
if (!$is_admmod && $pun_user['g_deledit_interval'] != 0 && (time()-$cur_post['posted']) > $pun_user['g_deledit_interval'])
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the delete.php language file
|
||||
require PUN_ROOT.'lang/'.$pun_user['language'].'/delete.php';
|
||||
|
||||
|
||||
if (isset($_POST['delete']))
|
||||
{
|
||||
// Make sure they got here from the site
|
||||
confirm_referrer('delete.php');
|
||||
|
||||
require PUN_ROOT.'include/search_idx.php';
|
||||
|
||||
if ($is_topic_post)
|
||||
{
|
||||
// Delete the topic and all of its posts
|
||||
delete_topic($cur_post['tid'], $cur_post['no_sum_mess']); // not sum - Visman
|
||||
update_forum($cur_post['fid']);
|
||||
|
||||
redirect('viewforum.php?id='.$cur_post['fid'], $lang_delete['Topic del redirect']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete just this one post
|
||||
delete_post($id, $cur_post['tid']);
|
||||
update_forum($cur_post['fid']);
|
||||
|
||||
// При удалении одиночного сообщения, уменьшим кол-во сообщений у пользователя - Visman
|
||||
// not sum - Visman
|
||||
if ($cur_post['no_sum_mess'] == 0 && $cur_post['poster_id'] > 1)
|
||||
$db->query('UPDATE '.$db->prefix.'users SET num_posts=num_posts-1 WHERE id='.$cur_post['poster_id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Redirect towards the previous post
|
||||
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['tid'].' AND id < '.$id.' ORDER BY id DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
|
||||
$post_id = $db->result($result);
|
||||
|
||||
redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_delete['Post del redirect']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_delete['Delete post']);
|
||||
define ('PUN_ACTIVE_PAGE', 'index');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
require PUN_ROOT.'include/parser.php';
|
||||
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
|
||||
|
||||
?>
|
||||
<div class="linkst">
|
||||
<div class="inbox">
|
||||
<ul class="crumbs">
|
||||
<li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
|
||||
<li><span>» </span><a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li>
|
||||
<li><span>» </span><a href="viewtopic.php?pid=<?php echo $id ?>#p<?php echo $id ?>"><?php echo pun_htmlspecialchars($cur_post['subject']) ?></a></li>
|
||||
<li><span>» </span><strong><?php echo $lang_delete['Delete post'] ?></strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="blockform">
|
||||
<h2><span><?php echo $lang_delete['Delete post'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form method="post" action="delete.php?id=<?php echo $id ?>">
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="inform">
|
||||
<div class="forminfo">
|
||||
<h3><span><?php printf($is_topic_post ? $lang_delete['Topic by'] : $lang_delete['Reply by'], '<strong>'.pun_htmlspecialchars($cur_post['poster']).'</strong>', format_time($cur_post['posted'])) ?></span></h3>
|
||||
<p><?php echo ($is_topic_post) ? '<strong>'.$lang_delete['Topic warning'].'</strong>' : '<strong>'.$lang_delete['Warning'].'</strong>' ?><br /><?php echo $lang_delete['Delete info'] ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="buttons"><input type="submit" name="delete" value="<?php echo $lang_delete['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="postreview">
|
||||
<div class="blockpost">
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<div class="postbody">
|
||||
<div class="postleft">
|
||||
<dl>
|
||||
<dt><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></dt>
|
||||
<dd><span><?php echo format_time($cur_post['posted']) ?></span></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="postright">
|
||||
<div class="postmsg">
|
||||
<?php echo $cur_post['message']."\n" ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
386
edit.php
Normal file
|
@ -0,0 +1,386 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
require PUN_ROOT.'include/poll.php';
|
||||
|
||||
if ($pun_user['g_read_board'] == '0')
|
||||
message($lang_common['No view'], false, '403 Forbidden');
|
||||
|
||||
|
||||
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
|
||||
if ($id < 1)
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
// MOD last topic on index - f.last_post_id, - мод ограничения времени редактирвания, добавил p.posted as pposted, p.edit_post - StickFP Add t.stick_fp, - MOD warnings Add , w.message AS warning - t.poll_type, t.poll_time, t.poll_term, t.poll_kol, - Visman
|
||||
// Fetch some info about the post, the topic and the forum
|
||||
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, f.last_post_id, t.id AS tid, t.stick_fp, t.subject, t.posted, t.first_post_id, t.sticky, t.closed, t.poll_type, t.poll_time, t.poll_term, t.poll_kol, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted as pposted, p.edit_post, w.message AS warning FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'warnings AS w ON p.id=w.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
|
||||
if (!$db->num_rows($result))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
$cur_post = $db->fetch_assoc($result);
|
||||
|
||||
// MOD subforums - Visman
|
||||
if (!isset($sf_array_asc[$cur_post['fid']]))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
|
||||
// Sort out who the moderators are and if we are currently a moderator (or an admin)
|
||||
$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array();
|
||||
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
|
||||
|
||||
$can_edit_subject = $id == $cur_post['first_post_id'];
|
||||
|
||||
if ($pun_config['o_censoring'] == '1')
|
||||
{
|
||||
$cur_post['subject'] = censor_words($cur_post['subject']);
|
||||
$cur_post['message'] = censor_words($cur_post['message']);
|
||||
}
|
||||
|
||||
// Do we have permission to edit this post?
|
||||
if (($pun_user['g_edit_posts'] == '0' ||
|
||||
$cur_post['poster_id'] != $pun_user['id'] ||
|
||||
$cur_post['closed'] == '1') &&
|
||||
!$is_admmod)
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
if ($is_admmod && $pun_user['g_id'] != PUN_ADMIN && in_array($cur_post['poster_id'], get_admin_ids()))
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// мод ограничения времени редактирвания - Visman
|
||||
if (!$is_admmod && $pun_user['g_deledit_interval'] != 0 && $cur_post['edit_post'] != 1 && (time()-$cur_post['pposted']) > $pun_user['g_deledit_interval'])
|
||||
message($lang_common['No permission'], false, '403 Forbidden');
|
||||
|
||||
// Load the post.php language file
|
||||
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';
|
||||
|
||||
// Start with a clean slate
|
||||
$errors = array();
|
||||
|
||||
|
||||
if (isset($_POST['form_sent']))
|
||||
{
|
||||
// Make sure they got here from the site
|
||||
confirm_referrer('edit.php');
|
||||
|
||||
// If it's a topic it must contain a subject
|
||||
if ($can_edit_subject)
|
||||
{
|
||||
$subject = pun_trim($_POST['req_subject']);
|
||||
|
||||
if ($pun_config['o_censoring'] == '1')
|
||||
$censored_subject = pun_trim(censor_words($subject));
|
||||
|
||||
if ($subject == '')
|
||||
$errors[] = $lang_post['No subject'];
|
||||
else if ($pun_config['o_censoring'] == '1' && $censored_subject == '')
|
||||
$errors[] = $lang_post['No subject after censoring'];
|
||||
else if (pun_strlen($subject) > 70)
|
||||
$errors[] = $lang_post['Too long subject'];
|
||||
else if ($pun_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$pun_user['is_admmod'])
|
||||
$errors[] = $lang_post['All caps subject'];
|
||||
|
||||
poll_form_validate($cur_post['tid'], $errors);
|
||||
|
||||
} else { // MOD warnings - Visman
|
||||
$subject = $cur_post['subject'];
|
||||
}
|
||||
|
||||
// Clean up message from POST
|
||||
$message = pun_linebreaks(pun_trim($_POST['req_message']));
|
||||
|
||||
// Here we use strlen() not pun_strlen() as we want to limit the post to PUN_MAX_POSTSIZE bytes, not characters
|
||||
if (pun_strlen($message) > PUN_MAX_POSTSIZE)
|
||||
$errors[] = sprintf($lang_post['Too long message'], forum_number_format(PUN_MAX_POSTSIZE));
|
||||
else if ($pun_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$pun_user['is_admmod'])
|
||||
$errors[] = $lang_post['All caps message'];
|
||||
|
||||
// Validate BBCode syntax
|
||||
if ($pun_config['p_message_bbcode'] == '1')
|
||||
{
|
||||
require PUN_ROOT.'include/parser.php';
|
||||
$message = preparse_bbcode($message, $errors);
|
||||
}
|
||||
|
||||
if (empty($errors))
|
||||
{
|
||||
if ($message == '')
|
||||
$errors[] = $lang_post['No message'];
|
||||
else if ($pun_config['o_censoring'] == '1')
|
||||
{
|
||||
// Censor message to see if that causes problems
|
||||
$censored_message = pun_trim(censor_words($message));
|
||||
|
||||
if ($censored_message == '')
|
||||
$errors[] = $lang_post['No message after censoring'];
|
||||
}
|
||||
}
|
||||
|
||||
$hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0';
|
||||
$stick_topic = isset($_POST['stick_topic']) ? '1' : '0';
|
||||
if (!$is_admmod)
|
||||
$stick_topic = $cur_post['sticky'];
|
||||
|
||||
// Replace four-byte characters (MySQL cannot handle them)
|
||||
$message = strip_bad_multibyte_chars($message);
|
||||
|
||||
// Visman
|
||||
$edit_post = isset($_POST['editpost']) ? '1' : '0';
|
||||
if ($pun_user['g_id'] != PUN_ADMIN)
|
||||
$edit_post = $cur_post['edit_post'];
|
||||
|
||||
$stick_fp = isset($_POST['stickfp']) ? '1' : '0';
|
||||
if (!$is_admmod)
|
||||
$stick_fp = $cur_post['stick_fp'];
|
||||
|
||||
// Did everything go according to plan?
|
||||
if (empty($errors) && !isset($_POST['preview']))
|
||||
{
|
||||
$is_modified = ($subject != $cur_post['subject'] ||
|
||||
$message != $cur_post['message'] ||
|
||||
$hide_smilies != $cur_post['hide_smilies'] ||
|
||||
$edit_post != $cur_post['edit_post'] ||
|
||||
$stick_fp != $cur_post['stick_fp'] ||
|
||||
$stick_topic != $cur_post['sticky']); // MOD warnings - Visman
|
||||
|
||||
$edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'' : '';
|
||||
$edited_sql.= ', edit_post='.$edit_post; // Visman
|
||||
|
||||
require PUN_ROOT.'include/search_idx.php';
|
||||
|
||||
// MOD warnings - Visman
|
||||
if ($is_modified)
|
||||
{
|
||||
if ($can_edit_subject)
|
||||
{
|
||||
// Update the topic and any redirect topics
|
||||
$db->query('UPDATE '.$db->prefix.'topics SET stick_fp='.$stick_fp.', subject=\''.$db->escape($subject).'\', sticky='.$stick_topic.' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
|
||||
|
||||
// Is the current topic last? - last topic on index - Visman
|
||||
$result = $db->query('SELECT 1 FROM '.$db->prefix.'posts WHERE id='.$cur_post['last_post_id'].' AND topic_id='.$cur_post['tid']);
|
||||
if ($db->num_rows($result))
|
||||
$db->query('UPDATE '.$db->prefix.'forums SET last_topic=\''.$db->escape($subject).'\' WHERE id='.$cur_post['fid']) or error('Unable to update last 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);
|
||||
}
|
||||
|
||||
if ($is_admmod)
|
||||
{
|
||||
$warning = pun_linebreaks(pun_trim($_POST['warning']));
|
||||
if ($warning != $cur_post['warning'])
|
||||
{
|
||||
$db->query('DELETE FROM '.$db->prefix.'warnings WHERE id='.$id) or error('Unable to remove warning', __FILE__, __LINE__, $db->error());
|
||||
$sql_warm = '';
|
||||
if (strlen($_POST['warning']) > 0 )
|
||||
{
|
||||
$db->query('INSERT INTO '.$db->prefix.'warnings (id, poster, poster_id, posted, message) VALUES('.$id.', \''.$db->escape($pun_user['username']).'\', '.$pun_user['id'].', '.time().', \''.$db->escape($_POST['warning']).'\')') or error('Unable to insert warning', __FILE__, __LINE__, $db->error());
|
||||
$sql_warm = ', warning_flag=1';
|
||||
}
|
||||
$result = $db->query('SELECT COUNT(p.id) FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'warnings AS w ON w.id=p.id WHERE p.poster_id='.$cur_post['poster_id']) or error('Unable to sum for posts', __FILE__, __LINE__, $db->error());
|
||||
$num_warn = $db->result($result);
|
||||
$db->query('UPDATE '.$db->prefix.'users SET warning_all='.$num_warn.$sql_warm.' WHERE id='.$cur_post['poster_id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_modified)
|
||||
{
|
||||
// Update the post
|
||||
$db->query('UPDATE '.$db->prefix.'posts SET message=\''.$db->escape($message).'\', hide_smilies='.$hide_smilies.$edited_sql.' WHERE id='.$id) or error('Unable to update post', __FILE__, __LINE__, $db->error());
|
||||
}
|
||||
// MOD warnings - Visman
|
||||
|
||||
// Poll MOD - Visman
|
||||
if ($can_edit_subject)
|
||||
poll_save($cur_post['tid']);
|
||||
// Poll MOD - Visman
|
||||
|
||||
redirect('viewtopic.php?pid='.$id.'#p'.$id, $lang_post['Edit redirect']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_post['Edit post']);
|
||||
$required_fields = array('req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
|
||||
$focus_element = array('edit', 'req_message');
|
||||
define('PUN_ACTIVE_PAGE', 'index');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
$cur_index = 1;
|
||||
|
||||
?>
|
||||
<div class="linkst">
|
||||
<div class="inbox">
|
||||
<ul class="crumbs">
|
||||
<li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
|
||||
<li><span>» </span><a href="viewforum.php?id=<?php echo $cur_post['fid'] ?>"><?php echo pun_htmlspecialchars($cur_post['forum_name']) ?></a></li>
|
||||
<li><span>» </span><a href="viewtopic.php?id=<?php echo $cur_post['tid'] ?>"><?php echo pun_htmlspecialchars($cur_post['subject']) ?></a></li>
|
||||
<li><span>» </span><strong><?php echo $lang_post['Edit post'] ?></strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
// If there are errors, we display them
|
||||
if (!empty($errors))
|
||||
{
|
||||
|
||||
?>
|
||||
<div id="posterror" class="block">
|
||||
<h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox error-info">
|
||||
<p><?php echo $lang_post['Post errors info'] ?></p>
|
||||
<ul class="error-list">
|
||||
<?php
|
||||
|
||||
foreach ($errors as $cur_error)
|
||||
echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
else if (isset($_POST['preview']))
|
||||
{
|
||||
require_once PUN_ROOT.'include/parser.php';
|
||||
$preview_message = parse_message($message, $hide_smilies);
|
||||
|
||||
?>
|
||||
<div id="postpreview" class="blockpost">
|
||||
<h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<div class="postbody">
|
||||
<div class="postright">
|
||||
<div class="postmsg">
|
||||
<?php echo $preview_message."\n" ?>
|
||||
<?php if ($can_edit_subject) poll_display_post($cur_post['tid'], $pun_user['id']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="editform" class="blockform">
|
||||
<h2><span><?php echo $lang_post['Edit post'] ?></span></h2>
|
||||
<div class="box">
|
||||
<form id="edit" method="post" action="edit.php?id=<?php echo $id ?>&action=edit" onsubmit="return process_form(this)">
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_post['Edit post legend'] ?></legend>
|
||||
<input type="hidden" name="form_sent" value="1" />
|
||||
<input type="hidden" name="csrf_hash" value="<?php echo csrf_hash() ?>" />
|
||||
<div class="infldset txtarea">
|
||||
<?php if ($can_edit_subject): ?> <label class="required"><strong><?php echo $lang_common['Subject'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br />
|
||||
<input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>
|
||||
<?php endif; ?> <label class="required"><strong><?php echo $lang_common['Message'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br />
|
||||
<textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo pun_htmlspecialchars(isset($_POST['req_message']) ? $message : $cur_post['message']) ?></textarea><br /></label>
|
||||
<ul class="bblinks">
|
||||
<li><span><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
|
||||
<li><span><a href="help.php#url" onclick="window.open(this.href); return false;"><?php echo $lang_common['url tag'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1' && $pun_user['g_post_links'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
|
||||
<li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1' && $pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
|
||||
<li><span><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a> <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
|
||||
</ul>
|
||||
<?php if ($is_admmod): ?> <label><strong><?php echo $lang_common['Moderator'] ?></strong><br />
|
||||
<input class="longinput" type="text" name="warning" size="80" maxlength="5000" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['warning']) ? $_POST['warning'] : $cur_post['warning']) ?>" /><br /></label>
|
||||
<?php elseif ($cur_post['warning'] != ''): ?>
|
||||
<div class="postwarn">
|
||||
<?php echo pun_htmlspecialchars($cur_post['warning'])."\n" ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
|
||||
$checkboxes = array();
|
||||
if ($can_edit_subject && $is_admmod)
|
||||
{
|
||||
if (isset($_POST['stick_topic']) || !isset($_POST['form_sent']) && $cur_post['sticky'] == '1')
|
||||
$checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" checked="checked" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>';
|
||||
else
|
||||
$checkboxes[] = '<label><input type="checkbox" name="stick_topic" value="1" tabindex="'.($cur_index++).'" />'.$lang_common['Stick topic'].'<br /></label>';
|
||||
}
|
||||
|
||||
if ($pun_config['o_smilies'] == '1')
|
||||
{
|
||||
if (isset($_POST['hide_smilies']) || !isset($_POST['form_sent']) && $cur_post['hide_smilies'] == '1')
|
||||
$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" checked="checked" tabindex="'.($cur_index++).'" />'.$lang_post['Hide smilies'].'<br /></label>';
|
||||
else
|
||||
$checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'" />'.$lang_post['Hide smilies'].'<br /></label>';
|
||||
}
|
||||
|
||||
if ($is_admmod)
|
||||
{
|
||||
if (isset($_POST['silent']) || !isset($_POST['form_sent']))
|
||||
$checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" checked="checked" />'.$lang_post['Silent edit'].'<br /></label>';
|
||||
else
|
||||
$checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" />'.$lang_post['Silent edit'].'<br /></label>';
|
||||
// StickFP - Visman
|
||||
if ($can_edit_subject)
|
||||
{
|
||||
if (isset($_POST['stickfp']) || !isset($_POST['form_sent']) && $cur_post['stick_fp'] == '1')
|
||||
$checkboxes[] = '<label><input type="checkbox" name="stickfp" value="1" tabindex="'.($cur_index++).'" checked="checked" />'.$lang_post['Stick first post'].'<br /></label>';
|
||||
else
|
||||
$checkboxes[] = '<label><input type="checkbox" name="stickfp" value="1" tabindex="'.($cur_index++).'" />'.$lang_post['Stick first post'].'<br /></label>';
|
||||
}
|
||||
// StickFP - Visman
|
||||
}
|
||||
// мод ограничения времени редактирвания - Visman
|
||||
if ($pun_user['g_id'] == PUN_ADMIN)
|
||||
{
|
||||
if (isset($_POST['editpost']) || !isset($_POST['form_sent']) && $cur_post['edit_post'] == '1')
|
||||
$checkboxes[] = '<label><input type="checkbox" name="editpost" value="1" tabindex="'.($cur_index++).'" checked="checked" />'.$lang_post['EditPost edit'].'<br /></label>';
|
||||
else
|
||||
$checkboxes[] = '<label><input type="checkbox" name="editpost" value="1" tabindex="'.($cur_index++).'" />'.$lang_post['EditPost edit'].'<br /></label>';
|
||||
}
|
||||
|
||||
if (!empty($checkboxes))
|
||||
{
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div class="inform">
|
||||
<fieldset>
|
||||
<legend><?php echo $lang_common['Options'] ?></legend>
|
||||
<div class="infldset">
|
||||
<div class="rbox">
|
||||
<?php echo implode("\n\t\t\t\t\t\t\t", $checkboxes)."\n" ?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<?php if ($can_edit_subject) poll_form_edit($cur_post['tid']); ?>
|
||||
<p class="buttons"><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /> <input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
require PUN_ROOT.'include/bbcode.inc.php';
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
547
extern.php
Normal file
|
@ -0,0 +1,547 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
INSTRUCTIONS
|
||||
|
||||
This script is used to include information about your board from
|
||||
pages outside the forums and to syndicate news about recent
|
||||
discussions via RSS/Atom/XML. The script can display a list of
|
||||
recent discussions, a list of active users or a collection of
|
||||
general board statistics. The script can be called directly via
|
||||
an URL, from a PHP include command or through the use of Server
|
||||
Side Includes (SSI).
|
||||
|
||||
The scripts behaviour is controlled via variables supplied in the
|
||||
URL to the script. The different variables are: action (what to
|
||||
do), show (how many items to display), fid (the ID or IDs of
|
||||
the forum(s) to poll for topics), nfid (the ID or IDs of forums
|
||||
that should be excluded), tid (the ID of the topic from which to
|
||||
display posts) and type (output as HTML or RSS). The only
|
||||
mandatory variable is action. Possible/default values are:
|
||||
|
||||
action: feed - show most recent topics/posts (HTML or RSS)
|
||||
online - show users online (HTML)
|
||||
online_full - as above, but includes a full list (HTML)
|
||||
stats - show board statistics (HTML)
|
||||
|
||||
type: rss - output as RSS 2.0
|
||||
atom - output as Atom 1.0
|
||||
xml - output as XML
|
||||
html - output as HTML (<li>'s)
|
||||
|
||||
fid: One or more forum IDs (comma-separated). If ignored,
|
||||
topics from all readable forums will be pulled.
|
||||
|
||||
nfid: One or more forum IDs (comma-separated) that are to be
|
||||
excluded. E.g. the ID of a a test forum.
|
||||
|
||||
tid: A topic ID from which to show posts. If a tid is supplied,
|
||||
fid and nfid are ignored.
|
||||
|
||||
show: Any integer value between 1 and 50. The default is 15.
|
||||
|
||||
order: last_post - show topics ordered by when they were last
|
||||
posted in, giving information about the reply.
|
||||
posted - show topics ordered by when they were first
|
||||
posted, giving information about the original post.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
define('PUN_QUIET_VISIT', 1);
|
||||
|
||||
if (!defined('PUN_ROOT'))
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
|
||||
// The length at which topic subjects will be truncated (for HTML output)
|
||||
if (!defined('FORUM_EXTERN_MAX_SUBJECT_LENGTH'))
|
||||
define('FORUM_EXTERN_MAX_SUBJECT_LENGTH', 30);
|
||||
|
||||
// If we're a guest and we've sent a username/pass, we can try to authenticate using those details
|
||||
if ($pun_user['is_guest'] && isset($_SERVER['PHP_AUTH_USER']))
|
||||
authenticate_user($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
|
||||
|
||||
if ($pun_user['g_read_board'] == '0')
|
||||
{
|
||||
http_authenticate_user();
|
||||
exit($lang_common['No view']);
|
||||
}
|
||||
|
||||
$action = isset($_GET['action']) ? strtolower($_GET['action']) : 'feed';
|
||||
|
||||
// Handle a couple old formats, from FluxBB 1.2
|
||||
switch ($action)
|
||||
{
|
||||
case 'active':
|
||||
$action = 'feed';
|
||||
$_GET['order'] = 'last_post';
|
||||
break;
|
||||
|
||||
case 'new':
|
||||
$action = 'feed';
|
||||
$_GET['order'] = 'posted';
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Sends the proper headers for Basic HTTP Authentication
|
||||
//
|
||||
function http_authenticate_user()
|
||||
{
|
||||
global $pun_config, $pun_user;
|
||||
|
||||
if (!$pun_user['is_guest'])
|
||||
return;
|
||||
|
||||
header('WWW-Authenticate: Basic realm="'.$pun_config['o_board_title'].' External Syndication"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Output $feed as RSS 2.0
|
||||
//
|
||||
function output_rss($feed)
|
||||
{
|
||||
global $lang_common, $pun_config;
|
||||
|
||||
// Send XML/no cache headers
|
||||
header('Content-Type: application/xml; charset=utf-8');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n";
|
||||
echo "\t".'<channel>'."\n";
|
||||
echo "\t\t".'<atom:link href="'.pun_htmlspecialchars(get_current_url()).'" rel="self" type="application/rss+xml" />'."\n";
|
||||
echo "\t\t".'<title><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n";
|
||||
echo "\t\t".'<link>'.pun_htmlspecialchars($feed['link']).'</link>'."\n";
|
||||
echo "\t\t".'<description><![CDATA['.escape_cdata($feed['description']).']]></description>'."\n";
|
||||
echo "\t\t".'<lastBuildDate>'.gmdate('r', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</lastBuildDate>'."\n";
|
||||
|
||||
if ($pun_config['o_show_version'] == '1')
|
||||
echo "\t\t".'<generator>FluxBB '.$pun_config['o_cur_version'].'</generator>'."\n";
|
||||
else
|
||||
echo "\t\t".'<generator>FluxBB</generator>'."\n";
|
||||
|
||||
foreach ($feed['items'] as $item)
|
||||
{
|
||||
echo "\t\t".'<item>'."\n";
|
||||
echo "\t\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n";
|
||||
echo "\t\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n";
|
||||
echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n";
|
||||
echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'dummy@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n";
|
||||
echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n";
|
||||
echo "\t\t\t".'<guid>'.pun_htmlspecialchars($item['link']).'</guid>'."\n";
|
||||
|
||||
echo "\t\t".'</item>'."\n";
|
||||
}
|
||||
|
||||
echo "\t".'</channel>'."\n";
|
||||
echo '</rss>'."\n";
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Output $feed as Atom 1.0
|
||||
//
|
||||
function output_atom($feed)
|
||||
{
|
||||
global $lang_common, $pun_config;
|
||||
|
||||
// Send XML/no cache headers
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
echo '<feed xmlns="http://www.w3.org/2005/Atom">'."\n";
|
||||
|
||||
echo "\t".'<title type="html"><![CDATA['.escape_cdata($feed['title']).']]></title>'."\n";
|
||||
echo "\t".'<link rel="self" href="'.pun_htmlspecialchars(get_current_url()).'"/>'."\n";
|
||||
echo "\t".'<link href="'.pun_htmlspecialchars($feed['link']).'"/>'."\n";
|
||||
echo "\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</updated>'."\n";
|
||||
|
||||
if ($pun_config['o_show_version'] == '1')
|
||||
echo "\t".'<generator version="'.$pun_config['o_cur_version'].'">FluxBB</generator>'."\n";
|
||||
else
|
||||
echo "\t".'<generator>FluxBB</generator>'."\n";
|
||||
|
||||
echo "\t".'<id>'.pun_htmlspecialchars($feed['link']).'</id>'."\n";
|
||||
|
||||
$content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary';
|
||||
|
||||
foreach ($feed['items'] as $item)
|
||||
{
|
||||
echo "\t".'<entry>'."\n";
|
||||
echo "\t\t".'<title type="html"><![CDATA['.escape_cdata($item['title']).']]></title>'."\n";
|
||||
echo "\t\t".'<link rel="alternate" href="'.pun_htmlspecialchars($item['link']).'"/>'."\n";
|
||||
echo "\t\t".'<'.$content_tag.' type="html"><![CDATA['.escape_cdata($item['description']).']]></'.$content_tag.'>'."\n";
|
||||
echo "\t\t".'<author>'."\n";
|
||||
echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n";
|
||||
|
||||
if (isset($item['author']['email']))
|
||||
echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n";
|
||||
|
||||
if (isset($item['author']['uri']))
|
||||
echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n";
|
||||
|
||||
echo "\t\t".'</author>'."\n";
|
||||
echo "\t\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', $item['pubdate']).'</updated>'."\n";
|
||||
|
||||
echo "\t\t".'<id>'.pun_htmlspecialchars($item['link']).'</id>'."\n";
|
||||
echo "\t".'</entry>'."\n";
|
||||
}
|
||||
|
||||
echo '</feed>'."\n";
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Output $feed as XML
|
||||
//
|
||||
function output_xml($feed)
|
||||
{
|
||||
global $lang_common, $pun_config;
|
||||
|
||||
// Send XML/no cache headers
|
||||
header('Content-Type: application/xml; charset=utf-8');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
echo '<source>'."\n";
|
||||
echo "\t".'<url>'.pun_htmlspecialchars($feed['link']).'</url>'."\n";
|
||||
|
||||
$forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic';
|
||||
|
||||
foreach ($feed['items'] as $item)
|
||||
{
|
||||
echo "\t".'<'.$forum_tag.' id="'.$item['id'].'">'."\n";
|
||||
|
||||
echo "\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n";
|
||||
echo "\t\t".'<link>'.pun_htmlspecialchars($item['link']).'</link>'."\n";
|
||||
echo "\t\t".'<content><![CDATA['.escape_cdata($item['description']).']]></content>'."\n";
|
||||
echo "\t\t".'<author>'."\n";
|
||||
echo "\t\t\t".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'."\n";
|
||||
|
||||
if (isset($item['author']['email']))
|
||||
echo "\t\t\t".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'."\n";
|
||||
|
||||
if (isset($item['author']['uri']))
|
||||
echo "\t\t\t".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'."\n";
|
||||
|
||||
echo "\t\t".'</author>'."\n";
|
||||
echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n";
|
||||
|
||||
echo "\t".'</'.$forum_tag.'>'."\n";
|
||||
}
|
||||
|
||||
echo '</source>'."\n";
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Output $feed as HTML (using <li> tags)
|
||||
//
|
||||
function output_html($feed)
|
||||
{
|
||||
|
||||
// Send the Content-type header in case the web server is setup to send something else
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
|
||||
foreach ($feed['items'] as $item)
|
||||
{
|
||||
if (utf8_strlen($item['title']) > FORUM_EXTERN_MAX_SUBJECT_LENGTH)
|
||||
$subject_truncated = pun_htmlspecialchars(pun_trim(utf8_substr($item['title'], 0, (FORUM_EXTERN_MAX_SUBJECT_LENGTH - 5)))).' …';
|
||||
else
|
||||
$subject_truncated = pun_htmlspecialchars($item['title']);
|
||||
|
||||
echo '<li><a href="'.pun_htmlspecialchars($item['link']).'" title="'.pun_htmlspecialchars($item['title']).'">'.$subject_truncated.'</a></li>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Show recent discussions
|
||||
if ($action == 'feed')
|
||||
{
|
||||
require PUN_ROOT.'include/parser.php';
|
||||
|
||||
// Determine what type of feed to output
|
||||
$type = isset($_GET['type']) ? strtolower($_GET['type']) : 'html';
|
||||
if (!in_array($type, array('html', 'rss', 'atom', 'xml')))
|
||||
$type = 'html';
|
||||
|
||||
$show = isset($_GET['show']) ? intval($_GET['show']) : 15;
|
||||
if ($show < 1 || $show > 50)
|
||||
$show = 15;
|
||||
|
||||
// Was a topic ID supplied?
|
||||
if (isset($_GET['tid']))
|
||||
{
|
||||
$tid = intval($_GET['tid']);
|
||||
|
||||
// Fetch topic subject
|
||||
$result = $db->query('SELECT t.subject, t.first_post_id FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL AND t.id='.$tid) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
|
||||
if (!$db->num_rows($result))
|
||||
{
|
||||
http_authenticate_user();
|
||||
exit($lang_common['Bad request']);
|
||||
}
|
||||
|
||||
$cur_topic = $db->fetch_assoc($result);
|
||||
|
||||
if ($pun_config['o_censoring'] == '1')
|
||||
$cur_topic['subject'] = censor_words($cur_topic['subject']);
|
||||
|
||||
// Setup the feed
|
||||
$feed = array(
|
||||
'title' => $pun_config['o_board_title'].$lang_common['Title separator'].$cur_topic['subject'],
|
||||
'link' => get_base_url(true).'/viewtopic.php?id='.$tid,
|
||||
'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']),
|
||||
'items' => array(),
|
||||
'type' => 'posts'
|
||||
);
|
||||
|
||||
// Fetch $show posts
|
||||
$result = $db->query('SELECT p.id, p.poster, p.message, p.hide_smilies, p.posted, p.poster_id, u.email_setting, u.email, p.poster_email FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$tid.' ORDER BY p.posted DESC LIMIT '.$show) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
|
||||
while ($cur_post = $db->fetch_assoc($result))
|
||||
{
|
||||
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
|
||||
|
||||
$item = array(
|
||||
'id' => $cur_post['id'],
|
||||
'title' => $cur_topic['first_post_id'] == $cur_post['id'] ? $cur_topic['subject'] : $lang_common['RSS reply'].$cur_topic['subject'],
|
||||
'link' => get_base_url(true).'/viewtopic.php?pid='.$cur_post['id'].'#p'.$cur_post['id'],
|
||||
'description' => $cur_post['message'],
|
||||
'author' => array(
|
||||
'name' => $cur_post['poster'],
|
||||
),
|
||||
'pubdate' => $cur_post['posted']
|
||||
);
|
||||
|
||||
if ($cur_post['poster_id'] > 1)
|
||||
{
|
||||
if ($cur_post['email_setting'] == '0' && !$pun_user['is_guest'])
|
||||
$item['author']['email'] = $cur_post['email'];
|
||||
|
||||
$item['author']['uri'] = get_base_url(true).'/profile.php?id='.$cur_post['poster_id'];
|
||||
}
|
||||
else if ($cur_post['poster_email'] != '' && !$pun_user['is_guest'])
|
||||
$item['author']['email'] = $cur_post['poster_email'];
|
||||
|
||||
$feed['items'][] = $item;
|
||||
}
|
||||
|
||||
$output_func = 'output_'.$type;
|
||||
$output_func($feed);
|
||||
}
|
||||
else
|
||||
{
|
||||
$order_posted = isset($_GET['order']) && strtolower($_GET['order']) == 'posted';
|
||||
$forum_name = '';
|
||||
$forum_sql = '';
|
||||
|
||||
// Were any forum IDs supplied?
|
||||
if (isset($_GET['fid']) && is_scalar($_GET['fid']) && $_GET['fid'] != '')
|
||||
{
|
||||
$fids = explode(',', pun_trim($_GET['fid']));
|
||||
$fids = array_map('intval', $fids);
|
||||
|
||||
if (!empty($fids))
|
||||
$forum_sql .= ' AND t.forum_id IN('.implode(',', $fids).')';
|
||||
|
||||
if (count($fids) == 1)
|
||||
{
|
||||
// Fetch forum name
|
||||
$result = $db->query('SELECT f.forum_name FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fids[0]) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error());
|
||||
if ($db->num_rows($result))
|
||||
$forum_name = $lang_common['Title separator'].$db->result($result);
|
||||
}
|
||||
}
|
||||
|
||||
// Any forum IDs to exclude?
|
||||
if (isset($_GET['nfid']) && is_scalar($_GET['nfid']) && $_GET['nfid'] != '')
|
||||
{
|
||||
$nfids = explode(',', pun_trim($_GET['nfid']));
|
||||
$nfids = array_map('intval', $nfids);
|
||||
|
||||
if (!empty($nfids))
|
||||
$forum_sql .= ' AND t.forum_id NOT IN('.implode(',', $nfids).')';
|
||||
}
|
||||
|
||||
// Only attempt to cache if caching is enabled and we have all or a single forum
|
||||
if ($pun_config['o_feed_ttl'] > 0 && ($forum_sql == '' || ($forum_name != '' && !isset($_GET['nfid']))))
|
||||
$cache_id = 'feed'.sha1($pun_user['g_id'].'|'.$lang_common['lang_identifier'].'|'.($order_posted ? '1' : '0').($forum_name == '' ? '' : '|'.$fids[0]));
|
||||
|
||||
// Load cached feed
|
||||
if (isset($cache_id) && file_exists(FORUM_CACHE_DIR.'cache_'.$cache_id.'.php'))
|
||||
include FORUM_CACHE_DIR.'cache_'.$cache_id.'.php';
|
||||
|
||||
$now = time();
|
||||
if (!isset($feed) || $cache_expire < $now)
|
||||
{
|
||||
// Setup the feed
|
||||
$feed = array(
|
||||
'title' => $pun_config['o_board_title'].$forum_name,
|
||||
'link' => '/index.php',
|
||||
'description' => sprintf($lang_common['RSS description'], $pun_config['o_board_title']),
|
||||
'items' => array(),
|
||||
'type' => 'topics'
|
||||
);
|
||||
|
||||
// Fetch $show topics
|
||||
$result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.id='.($order_posted ? 't.first_post_id' : 't.last_post_id').' INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.($order_posted ? 't.posted' : 't.last_post').' DESC LIMIT '.(isset($cache_id) ? 50 : $show)) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
|
||||
while ($cur_topic = $db->fetch_assoc($result))
|
||||
{
|
||||
if ($pun_config['o_censoring'] == '1')
|
||||
$cur_topic['subject'] = censor_words($cur_topic['subject']);
|
||||
|
||||
$cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']);
|
||||
|
||||
$item = array(
|
||||
'id' => $cur_topic['id'],
|
||||
'title' => $cur_topic['subject'],
|
||||
'link' => '/viewtopic.php?id='.$cur_topic['id'].($order_posted ? '' : '&action=new'),
|
||||
'description' => $cur_topic['message'],
|
||||
'author' => array(
|
||||
'name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster']
|
||||
),
|
||||
'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post']
|
||||
);
|
||||
|
||||
if ($cur_topic['poster_id'] > 1)
|
||||
{
|
||||
if ($cur_topic['email_setting'] == '0' && !$pun_user['is_guest'])
|
||||
$item['author']['email'] = $cur_topic['email'];
|
||||
|
||||
$item['author']['uri'] = '/profile.php?id='.$cur_topic['poster_id'];
|
||||
}
|
||||
else if ($cur_topic['poster_email'] != '' && !$pun_user['is_guest'])
|
||||
$item['author']['email'] = $cur_topic['poster_email'];
|
||||
|
||||
$feed['items'][] = $item;
|
||||
}
|
||||
|
||||
// Output feed as PHP code
|
||||
if (isset($cache_id))
|
||||
{
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
$content = '<?php'."\n\n".'$feed = '.var_export($feed, true).';'."\n\n".'$cache_expire = '.($now + ($pun_config['o_feed_ttl'] * 60)).';'."\n\n".'?>';
|
||||
fluxbb_write_cache_file('cache_'.$cache_id.'.php', $content);
|
||||
}
|
||||
}
|
||||
|
||||
// If we only want to show a few items but due to caching we have too many
|
||||
if (count($feed['items']) > $show)
|
||||
$feed['items'] = array_slice($feed['items'], 0, $show);
|
||||
|
||||
// Prepend the current base URL onto some links. Done after caching to handle http/https correctly
|
||||
$feed['link'] = get_base_url(true).$feed['link'];
|
||||
|
||||
foreach ($feed['items'] as $key => $item)
|
||||
{
|
||||
$feed['items'][$key]['link'] = get_base_url(true).$item['link'];
|
||||
|
||||
if (isset($item['author']['uri']))
|
||||
$feed['items'][$key]['author']['uri'] = get_base_url(true).$item['author']['uri'];
|
||||
}
|
||||
|
||||
$output_func = 'output_'.$type;
|
||||
$output_func($feed);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// Show users online
|
||||
else if ($action == 'online' || $action == 'online_full')
|
||||
{
|
||||
// Load the index.php language file
|
||||
require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php';
|
||||
|
||||
// Fetch users online info and generate strings for output
|
||||
$num_guests = $num_users = 0;
|
||||
$users = array();
|
||||
|
||||
$result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
|
||||
|
||||
while ($pun_user_online = $db->fetch_assoc($result))
|
||||
{
|
||||
if ($pun_user_online['user_id'] > 1)
|
||||
{
|
||||
$users[] = ($pun_user['g_view_users'] == '1') ? '<a href="'.pun_htmlspecialchars(get_base_url(true)).'/profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>' : pun_htmlspecialchars($pun_user_online['ident']);
|
||||
++$num_users;
|
||||
}
|
||||
else
|
||||
++$num_guests;
|
||||
}
|
||||
|
||||
// Send the Content-type header in case the web server is setup to send something else
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
|
||||
echo sprintf($lang_index['Guests online'], forum_number_format($num_guests)).'<br />'."\n";
|
||||
|
||||
if ($action == 'online_full' && !empty($users))
|
||||
echo sprintf($lang_index['Users online'], implode(', ', $users)).'<br />'."\n";
|
||||
else
|
||||
echo sprintf($lang_index['Users online'], forum_number_format($num_users)).'<br />'."\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// Show board statistics
|
||||
else if ($action == 'stats')
|
||||
{
|
||||
// Load the index.php language file
|
||||
require PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/index.php';
|
||||
|
||||
// Collect some statistics from the database
|
||||
if (file_exists(FORUM_CACHE_DIR.'cache_users_info.php'))
|
||||
include FORUM_CACHE_DIR.'cache_users_info.php';
|
||||
|
||||
if (!defined('PUN_USERS_INFO_LOADED'))
|
||||
{
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_users_info_cache();
|
||||
require FORUM_CACHE_DIR.'cache_users_info.php';
|
||||
}
|
||||
|
||||
$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['total_topics'], $stats['total_posts']) = $db->fetch_row($result);
|
||||
|
||||
// Send the Content-type header in case the web server is setup to send something else
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
|
||||
echo sprintf($lang_index['No of users'], forum_number_format($stats['total_users'])).'<br />'."\n";
|
||||
echo sprintf($lang_index['Newest user'], (($pun_user['g_view_users'] == '1') ? '<a href="'.pun_htmlspecialchars(get_base_url(true)).'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a>' : pun_htmlspecialchars($stats['last_user']['username']))).'<br />'."\n";
|
||||
echo sprintf($lang_index['No of topics'], forum_number_format($stats['total_topics'])).'<br />'."\n";
|
||||
echo sprintf($lang_index['No of posts'], forum_number_format($stats['total_posts'])).'<br />'."\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// If we end up here, the script was called with some wacky parameters
|
||||
exit($lang_common['Bad request']);
|
BIN
favicon.ico
Normal file
After Width: | Height: | Size: 894 B |
189
footer.php
Normal file
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Make sure no one attempts to run this script "directly"
|
||||
if (!defined('PUN'))
|
||||
exit;
|
||||
|
||||
$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();
|
||||
|
||||
// START быстрое переключение языка - Visman
|
||||
if (!isset($languages) || !is_array($languages))
|
||||
$languages = forum_list_langs();
|
||||
|
||||
$lang_temp = '';
|
||||
if (count($languages) > 1)
|
||||
{
|
||||
$lang_temp .= "\t\t\t\t".'<form id="qjump2" action="misc.php" method="get">'."\n\t\t\t\t\t".'<div><label>'."\n\t\t\t\t\t\t".'<input type="hidden" name="csrf_hash" value="'.csrf_hash('misc.php').'" />'."\n\t\t\t\t\t\t".'<input type="hidden" name="action" value="lang" />'."\n\t\t\t\t\t\t".'<select name="lang" onchange="this.form.submit()">'."\n";
|
||||
foreach ($languages as $temp)
|
||||
{
|
||||
if ($pun_user['language'] == $temp)
|
||||
$lang_temp .= "\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
|
||||
else
|
||||
$lang_temp .= "\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
|
||||
}
|
||||
$lang_temp .= "\t\t\t\t\t\t".'</select></label>'."\n\t\t\t\t\t\t".'<input id="qjump2input" type="submit" value="'.$lang_common['Go'].'" />'."\n\t\t\t\t\t".'</div>'."\n\t\t\t\t".'</form>'."\n";
|
||||
|
||||
$page_js['c'][] = 'document.getElementById("qjump2input").style.display = "none";';
|
||||
}
|
||||
// END быстрое переключение языка - Visman
|
||||
|
||||
?>
|
||||
<div id="brdfooter" class="block">
|
||||
<h2><span><?php echo $lang_common['Board footer'] ?></span></h2>
|
||||
<div class="box">
|
||||
<?php
|
||||
|
||||
if (isset($footer_style) && ($footer_style == 'viewforum' || $footer_style == 'viewtopic') && $is_admmod)
|
||||
{
|
||||
echo "\t\t".'<div id="modcontrols" class="inbox">'."\n";
|
||||
|
||||
if ($footer_style == 'viewforum')
|
||||
{
|
||||
echo "\t\t\t".'<dl>'."\n";
|
||||
echo "\t\t\t\t".'<dt><strong>'.$lang_forum['Mod controls'].'</strong></dt>'."\n";
|
||||
echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&p='.$p.'">'.$lang_common['Moderate forum'].'</a></span></dd>'."\n";
|
||||
echo "\t\t\t".'</dl>'."\n";
|
||||
}
|
||||
else if ($footer_style == 'viewtopic')
|
||||
{
|
||||
echo "\t\t\t".'<dl>'."\n";
|
||||
echo "\t\t\t\t".'<dt><strong>'.$lang_topic['Mod controls'].'</strong></dt>'."\n";
|
||||
echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&tid='.$id.'&p='.$p.'">'.$lang_common['Moderate topic'].'</a>'.($num_pages > 1 ? ' (<a href="moderate.php?fid='.$forum_id.'&tid='.$id.'&action=all">'.$lang_common['All'].'</a>)' : '').'</span></dd>'."\n";
|
||||
echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&move_topics='.$id.'">'.$lang_common['Move topic'].'</a></span></dd>'."\n";
|
||||
|
||||
if ($cur_topic['closed'] == '1')
|
||||
echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&open='.$id.'&csrf_hash='.csrf_hash().'">'.$lang_common['Open topic'].'</a></span></dd>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&close='.$id.'&csrf_hash='.csrf_hash().'">'.$lang_common['Close topic'].'</a></span></dd>'."\n";
|
||||
|
||||
if ($cur_topic['sticky'] == '1')
|
||||
echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&unstick='.$id.'&csrf_hash='.csrf_hash().'">'.$lang_common['Unstick topic'].'</a></span></dd>'."\n";
|
||||
else
|
||||
echo "\t\t\t\t".'<dd><span><a href="moderate.php?fid='.$forum_id.'&stick='.$id.'&csrf_hash='.csrf_hash().'">'.$lang_common['Stick topic'].'</a></span></dd>'."\n";
|
||||
|
||||
echo "\t\t\t".'</dl>'."\n";
|
||||
}
|
||||
|
||||
echo "\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="brdfooternav" class="inbox">
|
||||
<?php
|
||||
|
||||
echo "\t\t\t".'<div class="conl">'."\n";
|
||||
|
||||
// Display the "Jump to" drop list
|
||||
if ($pun_config['o_quickjump'] == '1')
|
||||
{
|
||||
// Load cached quick jump
|
||||
if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php'))
|
||||
include FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php';
|
||||
|
||||
if (!defined('PUN_QJ_LOADED'))
|
||||
{
|
||||
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
|
||||
require PUN_ROOT.'include/cache.php';
|
||||
|
||||
generate_quickjump_cache($pun_user['g_id']);
|
||||
require FORUM_CACHE_DIR.'cache_quickjump_'.$pun_user['g_id'].'.php';
|
||||
}
|
||||
$page_js['c'][] = 'document.getElementById("qjump").getElementsByTagName("div")[0].getElementsByTagName("input")[0].style.display = "none";'; // Visman - скрываем кнопку перехода при включенном js
|
||||
}
|
||||
|
||||
echo $lang_temp; // быстрое переключение языка - Visman
|
||||
echo "\t\t\t".'</div>'."\n";
|
||||
|
||||
?>
|
||||
<div class="conr">
|
||||
<?php
|
||||
|
||||
// If no footer style has been specified, we use the default (only copyright/debug info)
|
||||
$footer_style = isset($footer_style) ? $footer_style : NULL;
|
||||
|
||||
if ($footer_style == 'index')
|
||||
{
|
||||
if ($pun_config['o_feed_type'] == '1')
|
||||
echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="extern.php?action=feed&type=rss">'.$lang_common['RSS active topics feed'].'</a></span></p>'."\n";
|
||||
else if ($pun_config['o_feed_type'] == '2')
|
||||
echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="extern.php?action=feed&type=atom">'.$lang_common['Atom active topics feed'].'</a></span></p>'."\n";
|
||||
}
|
||||
else if ($footer_style == 'viewforum')
|
||||
{
|
||||
if ($pun_config['o_feed_type'] == '1')
|
||||
echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="extern.php?action=feed&fid='.$forum_id.'&type=rss">'.$lang_common['RSS forum feed'].'</a></span></p>'."\n";
|
||||
else if ($pun_config['o_feed_type'] == '2')
|
||||
echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="extern.php?action=feed&fid='.$forum_id.'&type=atom">'.$lang_common['Atom forum feed'].'</a></span></p>'."\n";
|
||||
}
|
||||
else if ($footer_style == 'viewtopic')
|
||||
{
|
||||
if ($pun_config['o_feed_type'] == '1')
|
||||
echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="extern.php?action=feed&tid='.$id.'&type=rss">'.$lang_common['RSS topic feed'].'</a></span></p>'."\n";
|
||||
else if ($pun_config['o_feed_type'] == '2')
|
||||
echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="extern.php?action=feed&tid='.$id.'&type=atom">'.$lang_common['Atom topic feed'].'</a></span></p>'."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
<p id="poweredby"><?php printf($lang_common['Powered by'], '<a href="http://fluxbb.org/">FluxBB</a>'.(($pun_config['o_show_version'] == '1') ? ' '.$pun_config['o_cur_version'] : '')) ?></p>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
// Display debug info (if enabled/defined)
|
||||
if (defined('PUN_DEBUG'))
|
||||
{
|
||||
echo '<p id="debugtime">[ ';
|
||||
|
||||
// Calculate script generation time
|
||||
$time_diff = sprintf('%.3f', get_microtime() - $pun_start);
|
||||
echo sprintf($lang_common['Querytime'], $time_diff, $db->get_num_queries());
|
||||
|
||||
if (function_exists('memory_get_usage'))
|
||||
{
|
||||
echo ' - '.sprintf($lang_common['Memory usage'], file_size(memory_get_usage()));
|
||||
|
||||
if (function_exists('memory_get_peak_usage'))
|
||||
echo ' '.sprintf($lang_common['Peak usage'], file_size(memory_get_peak_usage()));
|
||||
}
|
||||
|
||||
echo ' ]</p>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// End the transaction
|
||||
$db->end_transaction();
|
||||
|
||||
// Display executed queries (if enabled)
|
||||
if (defined('PUN_SHOW_QUERIES'))
|
||||
display_saved_queries();
|
||||
|
||||
$tpl_temp = trim(ob_get_contents());
|
||||
$tpl_main = str_replace('<pun_footer>', $tpl_temp, $tpl_main);
|
||||
ob_end_clean();
|
||||
// END SUBST - <pun_footer>
|
||||
|
||||
|
||||
// Close the db connection (and free up any result data)
|
||||
$db->close();
|
||||
|
||||
if (isset($page_js))
|
||||
$tpl_main = str_replace('<!-- forum_javascript -->', generation_js($page_js), $tpl_main);
|
||||
|
||||
// Spit out the page
|
||||
exit($tpl_main);
|
342
header.php
Normal file
|
@ -0,0 +1,342 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Make sure no one attempts to run this script "directly"
|
||||
if (!defined('PUN'))
|
||||
exit;
|
||||
|
||||
// Send no-cache headers
|
||||
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :)
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache'); // For HTTP/1.0 compatibility
|
||||
|
||||
// Send the Content-type header in case the web server is setup to send something else
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
// Prevent site from being embedded in a frame unless FORUM_FRAME_OPTIONS is set
|
||||
// to a valid X-Frame-Options header value or false
|
||||
if (defined('FORUM_FRAME_OPTIONS'))
|
||||
{
|
||||
if (preg_match('/^(?:allow-from|deny|sameorigin)/i', FORUM_FRAME_OPTIONS))
|
||||
header('X-Frame-Options: '.FORUM_FRAME_OPTIONS);
|
||||
}
|
||||
else
|
||||
header('X-Frame-Options: deny');
|
||||
|
||||
// Load the template
|
||||
if (defined('PUN_ADMIN_CONSOLE'))
|
||||
$tpl_file = 'admin.tpl';
|
||||
else if (defined('PUN_HELP'))
|
||||
$tpl_file = 'help.tpl';
|
||||
else
|
||||
$tpl_file = 'main.tpl';
|
||||
|
||||
if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/'.$tpl_file))
|
||||
{
|
||||
$tpl_file = PUN_ROOT.'style/'.$pun_user['style'].'/'.$tpl_file;
|
||||
$tpl_inc_dir = PUN_ROOT.'style/'.$pun_user['style'].'/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl_file = PUN_ROOT.'include/template/'.$tpl_file;
|
||||
$tpl_inc_dir = PUN_ROOT.'include/user/';
|
||||
}
|
||||
|
||||
$tpl_main = file_get_contents($tpl_file);
|
||||
|
||||
// START SUBST - <pun_include "*">
|
||||
preg_match_all('%<pun_include "([^"]+)">%i', $tpl_main, $pun_includes, PREG_SET_ORDER);
|
||||
|
||||
foreach ($pun_includes as $cur_include)
|
||||
{
|
||||
ob_start();
|
||||
|
||||
$file_info = pathinfo($cur_include[1]);
|
||||
|
||||
if (!in_array($file_info['extension'], array('php', 'php4', 'php5', 'inc', 'html', 'txt'))) // Allow some extensions
|
||||
error(sprintf($lang_common['Pun include extension'], pun_htmlspecialchars($cur_include[0]), basename($tpl_file), pun_htmlspecialchars($file_info['extension'])));
|
||||
|
||||
if (strpos($file_info['dirname'], '..') !== false) // Don't allow directory traversal
|
||||
error(sprintf($lang_common['Pun include directory'], pun_htmlspecialchars($cur_include[0]), basename($tpl_file)));
|
||||
|
||||
// Allow for overriding user includes, too.
|
||||
if (file_exists($tpl_inc_dir.$cur_include[1]))
|
||||
require $tpl_inc_dir.$cur_include[1];
|
||||
else if (file_exists(PUN_ROOT.'include/user/'.$cur_include[1]))
|
||||
require PUN_ROOT.'include/user/'.$cur_include[1];
|
||||
else
|
||||
error(sprintf($lang_common['Pun include error'], pun_htmlspecialchars($cur_include[0]), basename($tpl_file)));
|
||||
|
||||
$tpl_temp = ob_get_contents();
|
||||
$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
|
||||
ob_end_clean();
|
||||
}
|
||||
// END SUBST - <pun_include "*">
|
||||
|
||||
|
||||
// START SUBST - <pun_language>
|
||||
$tpl_main = str_replace('<pun_language>', $lang_common['lang_identifier'], $tpl_main);
|
||||
// END SUBST - <pun_language>
|
||||
|
||||
|
||||
// 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_head>
|
||||
ob_start();
|
||||
|
||||
// Define $p if it's not set to avoid a PHP notice
|
||||
$p = isset($p) ? $p : null;
|
||||
|
||||
// Is this a page that we want search index spiders to index?
|
||||
if (!defined('PUN_ALLOW_INDEX'))
|
||||
echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
|
||||
|
||||
?>
|
||||
<title><?php echo generate_page_title($page_title, $p) ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
|
||||
<?php
|
||||
|
||||
if (defined('PUN_ADMIN_CONSOLE'))
|
||||
{
|
||||
if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/base_admin.css'))
|
||||
echo '<link rel="stylesheet" type="text/css" href="style/'.$pun_user['style'].'/base_admin.css" />'."\n";
|
||||
else
|
||||
echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
|
||||
}
|
||||
|
||||
if (isset($required_fields))
|
||||
{
|
||||
// Output JavaScript to validate form (make sure required fields are filled out)
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
function process_form(the_form)
|
||||
{
|
||||
var required_fields = {
|
||||
<?php
|
||||
// Output a JavaScript object with localised field names
|
||||
$tpl_temp = count($required_fields);
|
||||
foreach ($required_fields as $elem_orig => $elem_trans)
|
||||
{
|
||||
echo "\t\t\"".$elem_orig.'": "'.addslashes(str_replace(' ', ' ', $elem_trans));
|
||||
if (--$tpl_temp) echo "\",\n";
|
||||
else echo "\"\n\t};\n";
|
||||
}
|
||||
?>
|
||||
if (document.all || document.getElementById)
|
||||
{
|
||||
for (var i = 0; i < the_form.length; ++i)
|
||||
{
|
||||
var elem = the_form.elements[i];
|
||||
if (elem.name && required_fields[elem.name] && !elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type)))
|
||||
{
|
||||
alert('"' + required_fields[elem.name] + '" <?php echo $lang_common['required field'] ?>');
|
||||
elem.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
require PUN_ROOT.'include/fancybox.php';
|
||||
|
||||
// New PMS - Visman
|
||||
require PUN_ROOT.'include/pms_new/pmsnheader.php';
|
||||
|
||||
if (!empty($page_head))
|
||||
echo implode("\n", $page_head)."\n";
|
||||
|
||||
$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 - <body>
|
||||
if (isset($focus_element))
|
||||
{
|
||||
$tpl_main = str_replace('<body onload="', '<body onload="document.getElementById(\''.$focus_element[0].'\').elements[\''.$focus_element[1].'\'].focus();', $tpl_main);
|
||||
$tpl_main = str_replace('<body>', '<body onload="document.getElementById(\''.$focus_element[0].'\').elements[\''.$focus_element[1].'\'].focus()">', $tpl_main);
|
||||
}
|
||||
// END SUBST - <body>
|
||||
|
||||
|
||||
// START SUBST - <pun_page>
|
||||
$tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['SCRIPT_NAME'], '.php')), $tpl_main);
|
||||
// END SUBST - <pun_page>
|
||||
|
||||
|
||||
// START SUBST - <pun_title>
|
||||
$tpl_main = str_replace('<pun_title>', '<h1><a href="index.php">'.pun_htmlspecialchars($pun_config['o_board_title']).'</a></h1>', $tpl_main);
|
||||
// END SUBST - <pun_title>
|
||||
|
||||
|
||||
// START SUBST - <pun_desc>
|
||||
$tpl_main = str_replace('<pun_desc>', '<div id="brddesc">'.$pun_config['o_board_desc'].'</div>', $tpl_main);
|
||||
// END SUBST - <pun_desc>
|
||||
|
||||
|
||||
// START SUBST - <pun_navlinks>
|
||||
$links = array();
|
||||
|
||||
// Index should always be displayed
|
||||
$links[] = '<li id="navindex"'.((PUN_ACTIVE_PAGE == 'index') ? ' class="isactive"' : '').'><a href="index.php">'.$lang_common['Index'].'</a></li>';
|
||||
|
||||
if ($pun_user['g_read_board'] == '1' && $pun_user['g_view_users'] == '1')
|
||||
$links[] = '<li id="navuserlist"'.((PUN_ACTIVE_PAGE == 'userlist') ? ' class="isactive"' : '').'><a href="userlist.php">'.$lang_common['User list'].'</a></li>';
|
||||
|
||||
if ($pun_config['o_rules'] == '1' && (!$pun_user['is_guest'] || $pun_user['g_read_board'] == '1' || $pun_config['o_regs_allow'] == '1'))
|
||||
$links[] = '<li id="navrules"'.((PUN_ACTIVE_PAGE == 'rules') ? ' class="isactive"' : '').'><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a></li>';
|
||||
|
||||
if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1')
|
||||
$links[] = '<li id="navsearch"'.((PUN_ACTIVE_PAGE == 'search') ? ' class="isactive"' : '').'><a href="search.php">'.$lang_common['Search'].'</a></li>';
|
||||
|
||||
if ($pun_user['is_guest'])
|
||||
{
|
||||
$links[] = '<li id="navregister"'.((PUN_ACTIVE_PAGE == 'register') ? ' class="isactive"' : '').'><a href="register.php">'.$lang_common['Register'].'</a></li>';
|
||||
$links[] = '<li id="navlogin"'.((PUN_ACTIVE_PAGE == 'login') ? ' class="isactive"' : '').'><a href="login.php">'.$lang_common['Login'].'</a></li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$links[] = '<li id="navprofile"'.((PUN_ACTIVE_PAGE == 'profile') ? ' class="isactive"' : '').'><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a></li>';
|
||||
// New PMS
|
||||
if ($pun_config['o_pms_enabled'] == '1' && ($pun_user['g_pm'] == 1 || $pun_user['messages_new'] > 0))
|
||||
$links[] = '<li id="navpmsnew"'.((PUN_ACTIVE_PAGE == 'pms_new' || $pun_user['messages_new'] > 0) ? ' class="isactive"' : '').'><a href="pmsnew.php">'.$lang_common['PM'].(($pun_user['messages_new'] > 0) ? ' (<span'.((empty($pun_config['o_pms_flasher']) || PUN_ACTIVE_PAGE == 'pms_new') ? '' : ' class="remflasher"' ).'>'.$pun_user['messages_new'].'</span>)' : '').'</a></li>';
|
||||
// New PMS
|
||||
|
||||
if ($pun_user['is_admmod'])
|
||||
$links[] = '<li id="navadmin"'.((PUN_ACTIVE_PAGE == 'admin') ? ' class="isactive"' : '').'><a href="admin_index.php">'.$lang_common['Admin'].'</a></li>';
|
||||
|
||||
$links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'&csrf_hash='.csrf_hash('login.php').'">'.$lang_common['Logout'].'</a></li>';
|
||||
}
|
||||
|
||||
// Are there any additional navlinks we should insert into the array before imploding it?
|
||||
if ($pun_user['g_read_board'] == '1' && $pun_config['o_additional_navlinks'] != '')
|
||||
{
|
||||
if (preg_match_all('%([0-9]+)\s*=\s*(.*?)\n%s', $pun_config['o_additional_navlinks']."\n", $extra_links))
|
||||
{
|
||||
// Insert any additional links into the $links array (at the correct index)
|
||||
$num_links = count($extra_links[1]);
|
||||
for ($i = 0; $i < $num_links; ++$i)
|
||||
array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i].'</li>'));
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_temp = '<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>'."\n\t\t\t\t".implode("\n\t\t\t\t", $links)."\n\t\t\t".'</ul>'."\n\t\t".'</div>';
|
||||
$tpl_temp = str_replace('<div id="brdmenu" class="inbox">'."\n\t\t\t".'<ul>', '<div id="brdmenu" class="inbox">'."\n\t\t\t".'<input type="checkbox" id="brdmenu-checkbox" style="display: none;" />'."\n\t\t\t".'<label for="brdmenu-checkbox" id="brdmenu-button"></label>'."\n\t\t\t".'<ul>', $tpl_temp); // Visman - Responsive Menu, only html+css
|
||||
$tpl_main = str_replace('<pun_navlinks>', $tpl_temp, $tpl_main);
|
||||
// END SUBST - <pun_navlinks>
|
||||
|
||||
|
||||
// START SUBST - <pun_status>
|
||||
$page_statusinfo = $page_topicsearches = array();
|
||||
|
||||
if ($pun_user['is_guest'])
|
||||
$page_statusinfo = '<p class="conl">'.$lang_common['Not logged in'].'</p>';
|
||||
else
|
||||
{
|
||||
$page_statusinfo[] = '<li><span>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></span></li>';
|
||||
$page_statusinfo[] = '<li><span>'.sprintf($lang_common['Last visit'], format_time($pun_user['last_visit'])).'</span></li>';
|
||||
|
||||
if ($pun_user['is_admmod'])
|
||||
{
|
||||
if ($pun_config['o_report_method'] == '0' || $pun_config['o_report_method'] == '2')
|
||||
{
|
||||
$result_header = $db->query('SELECT 1 FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());
|
||||
|
||||
if ($db->result($result_header))
|
||||
$page_statusinfo[] = '<li class="reportlink"><span><strong><a href="admin_reports.php">'.$lang_common['New reports'].'</a></strong></span></li>';
|
||||
}
|
||||
|
||||
if ($pun_config['o_maintenance'] == '1')
|
||||
$page_statusinfo[] = '<li class="maintenancelink"><span><strong><a href="admin_options.php#maintenance">'.$lang_common['Maintenance mode enabled'].'</a></strong></span></li>';
|
||||
}
|
||||
|
||||
if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1')
|
||||
{
|
||||
$page_topicsearches[] = '<a href="search.php?action=show_replies" title="'.$lang_common['Show posted topics'].'">'.$lang_common['Posted topics'].'</a>';
|
||||
$page_topicsearches[] = '<a href="search.php?action=show_new" title="'.$lang_common['Show new posts'].'">'.$lang_common['New posts header'].'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Quick searches
|
||||
if ($pun_user['g_read_board'] == '1' && $pun_user['g_search'] == '1')
|
||||
{
|
||||
$page_topicsearches[] = '<a href="search.php?action=show_recent" title="'.$lang_common['Show active topics'].'">'.$lang_common['Active topics'].'</a>';
|
||||
$page_topicsearches[] = '<a href="search.php?action=show_unanswered" title="'.$lang_common['Show unanswered topics'].'">'.$lang_common['Unanswered topics'].'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Generate all that jazz
|
||||
$tpl_temp = '<div id="brdwelcome" class="inbox">';
|
||||
|
||||
// The status information
|
||||
if (is_array($page_statusinfo))
|
||||
{
|
||||
$tpl_temp .= "\n\t\t\t".'<ul class="conl">';
|
||||
$tpl_temp .= "\n\t\t\t\t".implode("\n\t\t\t\t", $page_statusinfo);
|
||||
$tpl_temp .= "\n\t\t\t".'</ul>';
|
||||
}
|
||||
else
|
||||
$tpl_temp .= "\n\t\t\t".$page_statusinfo;
|
||||
|
||||
// Generate quicklinks
|
||||
if (!empty($page_topicsearches))
|
||||
{
|
||||
$tpl_temp .= "\n\t\t\t".'<ul class="conr">';
|
||||
$tpl_temp .= "\n\t\t\t\t".'<li><span>'.$lang_common['Topic searches'].' '.implode(' | ', $page_topicsearches).'</span></li>';
|
||||
$tpl_temp .= "\n\t\t\t".'</ul>';
|
||||
}
|
||||
|
||||
$tpl_temp .= "\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
|
||||
|
||||
$tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
|
||||
// END SUBST - <pun_status>
|
||||
|
||||
|
||||
// START SUBST - <pun_announcement>
|
||||
if ($pun_user['g_read_board'] == '1' && $pun_config['o_announcement'] == '1')
|
||||
{
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
<div id="announce" class="block">
|
||||
<div class="hd"><h2><span><?php echo $lang_common['Announcement'] ?></span></h2></div>
|
||||
<div class="box">
|
||||
<div id="announce-block" class="inbox">
|
||||
<div class="usercontent"><?php echo $pun_config['o_announcement_message'] ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$tpl_temp = trim(ob_get_contents());
|
||||
$tpl_main = str_replace('<pun_announcement>', $tpl_temp, $tpl_main);
|
||||
ob_end_clean();
|
||||
}
|
||||
else
|
||||
$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
|
||||
// END SUBST - <pun_announcement>
|
||||
|
||||
|
||||
// START SUBST - <pun_main>
|
||||
ob_start();
|
||||
|
||||
|
||||
define('PUN_HEADER', 1);
|
154
help.php
Normal file
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2008-2012 FluxBB
|
||||
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
|
||||
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
|
||||
*/
|
||||
|
||||
// Tell header.php to use the help template
|
||||
define('PUN_HELP', 1);
|
||||
|
||||
define('PUN_ROOT', dirname(__FILE__).'/');
|
||||
require PUN_ROOT.'include/common.php';
|
||||
|
||||
|
||||
if ($pun_user['g_read_board'] == '0')
|
||||
message($lang_common['No view'], false, '403 Forbidden');
|
||||
|
||||
|
||||
// Load the help.php language file
|
||||
require PUN_ROOT.'lang/'.$pun_user['language'].'/help.php';
|
||||
|
||||
|
||||
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_help['Help']);
|
||||
define('PUN_ACTIVE_PAGE', 'help');
|
||||
require PUN_ROOT.'header.php';
|
||||
|
||||
?>
|
||||
<h2><span><?php echo $lang_help['BBCode'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><a name="bbcode"></a><?php echo $lang_help['BBCode info 1'] ?></p>
|
||||
<p><?php echo $lang_help['BBCode info 2'] ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<h2><span><?php echo $lang_help['Text style'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><?php echo $lang_help['Text style info'] ?></p>
|
||||
<p><code>[b]<?php echo $lang_help['Bold text'] ?>[/b]</code> <?php echo $lang_help['produces'] ?> <samp><strong><?php echo $lang_help['Bold text'] ?></strong></samp></p>
|
||||
<p><code>[u]<?php echo $lang_help['Underlined text'] ?>[/u]</code> <?php echo $lang_help['produces'] ?> <samp><span class="bbu"><?php echo $lang_help['Underlined text'] ?></span></samp></p>
|
||||
<p><code>[i]<?php echo $lang_help['Italic text'] ?>[/i]</code> <?php echo $lang_help['produces'] ?> <samp><em><?php echo $lang_help['Italic text'] ?></em></samp></p>
|
||||
<p><code>[s]<?php echo $lang_help['Strike-through text'] ?>[/s]</code> <?php echo $lang_help['produces'] ?> <samp><span class="bbs"><?php echo $lang_help['Strike-through text'] ?></span></samp></p>
|
||||
<p><code>[del]<?php echo $lang_help['Deleted text'] ?>[/del]</code> <?php echo $lang_help['produces'] ?> <samp><del><?php echo $lang_help['Deleted text'] ?></del></samp></p>
|
||||
<p><code>[ins]<?php echo $lang_help['Inserted text'] ?>[/ins]</code> <?php echo $lang_help['produces'] ?> <samp><ins><?php echo $lang_help['Inserted text'] ?></ins></samp></p>
|
||||
<p><code>[em]<?php echo $lang_help['Emphasised text'] ?>[/em]</code> <?php echo $lang_help['produces'] ?> <samp><em><?php echo $lang_help['Emphasised text'] ?></em></samp></p>
|
||||
<p><code>[color=#FF0000]<?php echo $lang_help['Red text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <samp><span style="color: #ff0000"><?php echo $lang_help['Red text'] ?></span></samp></p>
|
||||
<p><code>[color=blue]<?php echo $lang_help['Blue text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <samp><span style="color: blue"><?php echo $lang_help['Blue text'] ?></span></samp></p>
|
||||
<p><code>[h]<?php echo $lang_help['Heading text'] ?>[/h]</code> <?php echo $lang_help['produces'] ?></p> <div class="postmsg"><h5><?php echo $lang_help['Heading text'] ?></h5></div>
|
||||
</div>
|
||||
</div>
|
||||
<h2><span><?php echo $lang_help['Links and images'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><?php echo $lang_help['Links info'] ?></p>
|
||||
<p><a name="url"></a><code>[url=<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a></samp></p>
|
||||
<p><code>[url]<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/') ?></a></samp></p>
|
||||
<p><code>[url=/help.php]<?php echo $lang_help['This help page'] ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/help.php') ?>"><?php echo $lang_help['This help page'] ?></a></samp></p>
|
||||
<p><code>[email]myname@example.com[/email]</code> <?php echo $lang_help['produces'] ?> <samp><a href="mailto:myname@example.com">myname@example.com</a></samp></p>
|
||||
<p><code>[email=myname@example.com]<?php echo $lang_help['My email address'] ?>[/email]</code> <?php echo $lang_help['produces'] ?> <samp><a href="mailto:myname@example.com"><?php echo $lang_help['My email address'] ?></a></samp></p>
|
||||
<p><code>[topic=1]<?php echo $lang_help['Test topic'] ?>[/topic]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?id=1') ?>"><?php echo $lang_help['Test topic'] ?></a></samp></p>
|
||||
<p><code>[topic]1[/topic]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?id=1') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?id=1') ?></a></samp></p>
|
||||
<p><code>[post=1]<?php echo $lang_help['Test post'] ?>[/post]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?pid=1#p1') ?>"><?php echo $lang_help['Test post'] ?></a></samp></p>
|
||||
<p><code>[post]1[/post]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?pid=1#p1') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?pid=1#p1') ?></a></samp></p>
|
||||
<p><code>[forum=1]<?php echo $lang_help['Test forum'] ?>[/forum]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewforum.php?id=1') ?>"><?php echo $lang_help['Test forum'] ?></a></samp></p>
|
||||
<p><code>[forum]1[/forum]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewforum.php?id=1') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/viewforum.php?id=1') ?></a></samp></p>
|
||||
<p><code>[user=2]<?php echo $lang_help['Test user'] ?>[/user]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/profile.php?id=2') ?>"><?php echo $lang_help['Test user'] ?></a></samp></p>
|
||||
<p><code>[user]2[/user]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/profile.php?id=2') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/profile.php?id=2') ?></a></samp></p>
|
||||
</div>
|
||||
<div class="inbox">
|
||||
<p><a name="img"></a><?php echo $lang_help['Images info'] ?></p>
|
||||
<p><code>[img=<?php echo $lang_help['FluxBB bbcode test'] ?>]<?php echo pun_htmlspecialchars(get_base_url(true)) ?>/img/test.png[/img]</code> <?php echo $lang_help['produces'] ?> <samp><img style="height: 21px" src="<?php echo pun_htmlspecialchars(get_base_url(true)) ?>/img/test.png" alt="<?php echo $lang_help['FluxBB bbcode test'] ?>" /></samp></p>
|
||||
</div>
|
||||
</div>
|
||||
<h2><span><?php echo $lang_help['Quotes'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><?php echo $lang_help['Quotes info'] ?></p>
|
||||
<p><code>[quote=James]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p>
|
||||
<p><?php echo $lang_help['produces quote box'] ?></p>
|
||||
<div class="postmsg">
|
||||
<div class="quotebox"><cite>James <?php echo $lang_common['wrote'] ?></cite><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div>
|
||||
</div>
|
||||
<p><?php echo $lang_help['Quotes info 2'] ?></p>
|
||||
<p><code>[quote]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p>
|
||||
<p><?php echo $lang_help['produces quote box'] ?></p>
|
||||
<div class="postmsg">
|
||||
<div class="quotebox"><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div>
|
||||
</div>
|
||||
<p><?php echo $lang_help['quote note'] ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<h2><span><?php echo $lang_help['Code'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><?php echo $lang_help['Code info'] ?></p>
|
||||
<p><code>[code]<?php echo $lang_help['Code text'] ?>[/code]</code></p>
|
||||
<p><?php echo $lang_help['produces code box'] ?></p>
|
||||
<div class="postmsg">
|
||||
<div class="codebox"><pre><code><?php echo $lang_help['Code text'] ?></code></pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2><span><?php echo $lang_help['Lists'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><a name="lists"></a><?php echo $lang_help['List info'] ?></p>
|
||||
<p><code>[list][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code>
|
||||
<br /><span><?php echo $lang_help['produces list'] ?></span></p>
|
||||
<div class="postmsg">
|
||||
<ul><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ul>
|
||||
</div>
|
||||
<p><code>[list=1][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code>
|
||||
<br /><span><?php echo $lang_help['produces decimal list'] ?></span></p>
|
||||
<div class="postmsg">
|
||||
<ol class="decimal"><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ol>
|
||||
</div>
|
||||
<p><code>[list=a][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code>
|
||||
<br /><span><?php echo $lang_help['produces alpha list'] ?></span></p>
|
||||
<div class="postmsg">
|
||||
<ol class="alpha"><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2><span><?php echo $lang_help['Nested tags'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><?php echo $lang_help['Nested tags info'] ?></p>
|
||||
<p><code>[b][u]<?php echo $lang_help['Bold, underlined text'] ?>[/u][/b]</code> <?php echo $lang_help['produces'] ?> <samp><strong><span class="bbu"><?php echo $lang_help['Bold, underlined text'] ?></span></strong></samp></p>
|
||||
</div>
|
||||
</div>
|
||||
<h2><span><?php echo $lang_help['Smilies'] ?></span></h2>
|
||||
<div class="box">
|
||||
<div class="inbox">
|
||||
<p><a name="smilies"></a><?php echo $lang_help['Smilies info'] ?></p>
|
||||
<?php
|
||||
|
||||
// Display the smiley set
|
||||
require PUN_ROOT.'include/parser.php';
|
||||
|
||||
$smiley_groups = array();
|
||||
|
||||
foreach ($smilies as $smiley_text => $smiley_img)
|
||||
$smiley_groups[$smiley_img][] = $smiley_text;
|
||||
|
||||
foreach ($smiley_groups as $smiley_img => $smiley_texts)
|
||||
echo "\t\t".'<p><code>'.implode('</code> '.$lang_common['and'].' <code>', $smiley_texts).'</code> <span>'.$lang_help['produces'].'</span> <samp><img src="'.pun_htmlspecialchars(get_base_url(true)).'/img/smilies/'.$smiley_img.'" alt="'.$smiley_texts[0].'" /></samp></p>'."\n";
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
require PUN_ROOT.'footer.php';
|
1
img/avatars/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
BIN
img/close.gif
Normal file
After Width: | Height: | Size: 125 B |
BIN
img/exp_down.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
img/exp_up.png
Normal file
After Width: | Height: | Size: 185 B |
BIN
img/f/blank.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
img/f/fancy_close.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
img/f/fancy_loading.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
img/f/fancy_nav_left.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
img/f/fancy_nav_right.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
img/f/fancy_shadow_e.png
Normal file
After Width: | Height: | Size: 107 B |
BIN
img/f/fancy_shadow_n.png
Normal file
After Width: | Height: | Size: 106 B |
BIN
img/f/fancy_shadow_ne.png
Normal file
After Width: | Height: | Size: 347 B |
BIN
img/f/fancy_shadow_nw.png
Normal file
After Width: | Height: | Size: 324 B |
BIN
img/f/fancy_shadow_s.png
Normal file
After Width: | Height: | Size: 111 B |
BIN
img/f/fancy_shadow_se.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
img/f/fancy_shadow_sw.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
img/f/fancy_shadow_w.png
Normal file
After Width: | Height: | Size: 103 B |
BIN
img/f/fancy_title_left.png
Normal file
After Width: | Height: | Size: 503 B |
BIN
img/f/fancy_title_main.png
Normal file
After Width: | Height: | Size: 96 B |
BIN
img/f/fancy_title_over.png
Normal file
After Width: | Height: | Size: 70 B |
BIN
img/f/fancy_title_right.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
img/f/fancybox-x.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
img/f/fancybox-y.png
Normal file
After Width: | Height: | Size: 176 B |
BIN
img/f/fancybox.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
img/f/fullexpand.gif
Normal file
After Width: | Height: | Size: 209 B |
1
img/f/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
BIN
img/flasher.gif
Normal file
After Width: | Height: | Size: 427 B |
BIN
img/grippie.png
Normal file
After Width: | Height: | Size: 162 B |
BIN
img/icons/gender_female.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
img/icons/gender_male.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
1
img/icons/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
1
img/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
BIN
img/loading.gif
Normal file
After Width: | Height: | Size: 673 B |
18
img/members/.htaccess
Normal file
|
@ -0,0 +1,18 @@
|
|||
Options -Indexes -ExecCGI
|
||||
|
||||
php_flag engine 0
|
||||
|
||||
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .php7 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||
AddType text/plain .phtml .php .php3 .php4 .php5 .php6 .php7 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Uncomment and properly set the RewriteBase if the rewrite rules are not working properly
|
||||
#RewriteBase /
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule .* nofile.gif [L]
|
||||
|
||||
</IfModule>
|
BIN
img/members/nofile.gif
Normal file
After Width: | Height: | Size: 631 B |
BIN
img/smilies/big_smile.png
Normal file
After Width: | Height: | Size: 373 B |
BIN
img/smilies/cool.png
Normal file
After Width: | Height: | Size: 380 B |
BIN
img/smilies/hmm.png
Normal file
After Width: | Height: | Size: 422 B |
1
img/smilies/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
BIN
img/smilies/lol.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
img/smilies/mad.png
Normal file
After Width: | Height: | Size: 409 B |
BIN
img/smilies/neutral.png
Normal file
After Width: | Height: | Size: 415 B |
BIN
img/smilies/roll.png
Normal file
After Width: | Height: | Size: 386 B |
BIN
img/smilies/sad.png
Normal file
After Width: | Height: | Size: 420 B |
BIN
img/smilies/smile.png
Normal file
After Width: | Height: | Size: 426 B |
BIN
img/smilies/tongue.png
Normal file
After Width: | Height: | Size: 416 B |
BIN
img/smilies/wink.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
img/smilies/yikes.png
Normal file
After Width: | Height: | Size: 406 B |
BIN
img/test.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
img/upf-i.png
Normal file
After Width: | Height: | Size: 649 B |
BIN
img/upf-it.png
Normal file
After Width: | Height: | Size: 668 B |
BIN
img/upf-x.png
Normal file
After Width: | Height: | Size: 778 B |
BIN
img/user_agent/browser/arora.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
img/user_agent/browser/avant.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/user_agent/browser/camino.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
img/user_agent/browser/chrome.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
img/user_agent/browser/chromium.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
img/user_agent/browser/epiphany.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/user_agent/browser/firefox.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
img/user_agent/browser/flock.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
img/user_agent/browser/galeon.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
img/user_agent/browser/icab.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/user_agent/browser/iceweasel.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
1
img/user_agent/browser/index.html
Normal file
|
@ -0,0 +1 @@
|
|||
<html><head><title>.</title></head><body>.</body></html>
|
BIN
img/user_agent/browser/internetexplorer.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
img/user_agent/browser/internetexplorer7.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/user_agent/browser/internetexplorer9.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
img/user_agent/browser/kmeleon.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
img/user_agent/browser/konqueror.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
img/user_agent/browser/maxthon.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
img/user_agent/browser/microsoftedge.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/user_agent/browser/netscape.png
Normal file
After Width: | Height: | Size: 1.3 KiB |