mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
- decreasing my linecount a bit. ;)
- please note that you are no longer able to administrate your board correctly if you are updating your cvs copy. git-svn-id: file:///svn/phpbb/trunk@5316 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1bf18e23ed
commit
417b6f5f0a
10 changed files with 0 additions and 5656 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,440 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
if (!$auth->acl_get('a_bbcode'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$module['POST']['BBCODES'] = basename(__FILE__) . $SID;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
|
|
||||||
// Include files
|
|
||||||
$phpbb_root_path = '../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
// Do we have general permissions?
|
|
||||||
if (!$auth->acl_get('a_bbcode'))
|
|
||||||
{
|
|
||||||
trigger_error('NO_ADMIN');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up general vars
|
|
||||||
$mode = request_var('mode', '');
|
|
||||||
$bbcode_id = request_var('bbcode', 0);
|
|
||||||
|
|
||||||
// Set up mode-specific vars
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'add':
|
|
||||||
$bbcode_match = $bbcode_tpl = '';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'edit':
|
|
||||||
$sql = 'SELECT bbcode_match, bbcode_tpl
|
|
||||||
FROM ' . BBCODES_TABLE . '
|
|
||||||
WHERE bbcode_id = ' . $bbcode_id;
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
if (!$row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
trigger_error('BBCODE_NOT_EXIST');
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$bbcode_match = $row['bbcode_match'];
|
|
||||||
$bbcode_tpl = htmlspecialchars($row['bbcode_tpl']);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'modify':
|
|
||||||
$sql = 'SELECT bbcode_id
|
|
||||||
FROM ' . BBCODES_TABLE . '
|
|
||||||
WHERE bbcode_id = ' . $bbcode_id;
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
if (!$row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
trigger_error('BBCODE_NOT_EXIST');
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// No break here
|
|
||||||
|
|
||||||
case 'create':
|
|
||||||
$bbcode_match = htmlspecialchars(stripslashes($_POST['bbcode_match']));
|
|
||||||
$bbcode_tpl = stripslashes($_POST['bbcode_tpl']);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do major work
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'edit':
|
|
||||||
case 'add':
|
|
||||||
adm_page_header($user->lang['BBCODES']);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang['BBCODES'] ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['BBCODES_EXPLAIN'] ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="admin_bbcodes.<?php echo $phpEx . $SID . '&mode=' . (($mode == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : '') ?>">
|
|
||||||
<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%">
|
|
||||||
<tr>
|
|
||||||
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang['BBCODE_USAGE'] ?></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="2"><?php echo $user->lang['BBCODE_USAGE_EXPLAIN'] ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr valign="top">
|
|
||||||
<td class="row1" width="40%"><b><?php echo $user->lang['EXAMPLES'] ?></b><br /><br /><?php echo $user->lang['BBCODE_USAGE_EXAMPLE'] ?></td>
|
|
||||||
<td class="row2"><textarea name="bbcode_match" cols="60" rows="5"><?php echo $bbcode_match ?></textarea></td>
|
|
||||||
</tr>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br clear="all" />
|
|
||||||
|
|
||||||
<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%">
|
|
||||||
<tr>
|
|
||||||
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang['HTML_REPLACEMENT'] ?></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="2"><?php echo $user->lang['HTML_REPLACEMENT_EXPLAIN'] ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr valign="top">
|
|
||||||
<td class="row1" width="40%"><b><?php echo $user->lang['EXAMPLES'] ?></b><br /><br /><?php echo $user->lang['HTML_REPLACEMENT_EXAMPLE'] ?></td>
|
|
||||||
<td class="row2"><textarea name="bbcode_tpl" cols="60" rows="8"><?php echo $bbcode_tpl ?></textarea></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['SUBMIT'] ?>" class="btnmain" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br clear="all" />
|
|
||||||
|
|
||||||
<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%">
|
|
||||||
<tr>
|
|
||||||
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang['TOKENS'] ?></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="2"><?php echo $user->lang['TOKENS_EXPLAIN'] ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $user->lang['TOKEN'] ?></th>
|
|
||||||
<th><?php echo $user->lang['TOKEN_DEFINITION'] ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
foreach ($user->lang['tokens'] as $token => $token_explain)
|
|
||||||
{
|
|
||||||
?><tr valign="top">
|
|
||||||
<td class="row1">{<?php echo $token ?>}</td>
|
|
||||||
<td class="row2"><?php echo $token_explain ?></td>
|
|
||||||
</tr><?php
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'modify':
|
|
||||||
case 'create':
|
|
||||||
adm_page_header($user->lang['BBCODES']);
|
|
||||||
|
|
||||||
$data = build_regexp($bbcode_match, $bbcode_tpl);
|
|
||||||
|
|
||||||
$sql_ary = array(
|
|
||||||
'bbcode_tag' => $data['bbcode_tag'],
|
|
||||||
'bbcode_match' => $bbcode_match,
|
|
||||||
'bbcode_tpl' => $bbcode_tpl,
|
|
||||||
'first_pass_match' => $data['first_pass_match'],
|
|
||||||
'first_pass_replace' => $data['first_pass_replace'],
|
|
||||||
'second_pass_match' => $data['second_pass_match'],
|
|
||||||
'second_pass_replace' => $data['second_pass_replace']
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($mode == 'create')
|
|
||||||
{
|
|
||||||
/* TODO: look for SQL incompatibilities
|
|
||||||
// NOTE: I'm sure there was another simpler (and obvious) way of finding a suitable bbcode_id
|
|
||||||
$sql = 'SELECT b1.bbcode_id
|
|
||||||
FROM ' . BBCODES_TABLE . ' b1, ' . BBCODES_TABLE . ' b2
|
|
||||||
WHERE b2.bbcode_id > b1.bbcode_id
|
|
||||||
GROUP BY b1.bbcode_id
|
|
||||||
HAVING MIN(b2.bbcode_id) > b1.bbcode_id + 1
|
|
||||||
ORDER BY b1.bbcode_id ASC';
|
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
*/
|
|
||||||
$sql = 'SELECT MAX(bbcode_id) as bbcode_id
|
|
||||||
FROM ' . BBCODES_TABLE;
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if ($row)
|
|
||||||
{
|
|
||||||
$bbcode_id = $row['bbcode_id'] + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql = 'SELECT MIN(bbcode_id) AS min_id, MAX(bbcode_id) AS max_id
|
|
||||||
FROM ' . BBCODES_TABLE;
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if (empty($row['min_id']) || $row['min_id'] >= NUM_CORE_BBCODES)
|
|
||||||
{
|
|
||||||
$bbcode_id = NUM_CORE_BBCODES + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$bbcode_id = $row['max_id'] + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($bbcode_id > 31)
|
|
||||||
{
|
|
||||||
trigger_error('TOO_MANY_BBCODES');
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql_ary['bbcode_id'] = (int) $bbcode_id;
|
|
||||||
|
|
||||||
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
|
|
||||||
$lang = 'BBCODE_ADDED';
|
|
||||||
$log_action = 'LOG_BBCODE_ADD';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->sql_query('UPDATE ' . BBCODES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE bbcode_id = ' . $bbcode_id);
|
|
||||||
$lang = 'BBCODE_EDITED';
|
|
||||||
$log_action = 'LOG_BBCODE_EDIT';
|
|
||||||
}
|
|
||||||
|
|
||||||
add_log('admin', $log_action, $data['bbcode_tag']);
|
|
||||||
|
|
||||||
trigger_error($lang);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'delete':
|
|
||||||
$sql = 'SELECT bbcode_tag
|
|
||||||
FROM ' . BBCODES_TABLE . "
|
|
||||||
WHERE bbcode_id = $bbcode_id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
|
|
||||||
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// No break here
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
adm_page_header($user->lang['BBCODES']);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang['BBCODES'] ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['BBCODES_EXPLAIN'] ?></p>
|
|
||||||
|
|
||||||
|
|
||||||
<form method="post" action="admin_bbcodes.<?php echo $phpEx . $SID ?>&mode=add"><table cellspacing="1" cellpadding="0" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $user->lang['BBCODE_TAG'] ?></th>
|
|
||||||
<th><?php echo $user->lang['ACTION'] ?></th>
|
|
||||||
</tr><?php
|
|
||||||
|
|
||||||
$sql = 'SELECT *
|
|
||||||
FROM ' . BBCODES_TABLE . '
|
|
||||||
ORDER BY bbcode_id';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$row_class = '';
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="<?php echo $row_class ?>" align="center"><?php echo $row['bbcode_tag'] ?></td>
|
|
||||||
<td class="<?php echo $row_class ?>" align="center"><a href="admin_bbcodes.<?php echo $phpEx . $SID ?>&mode=edit&bbcode=<?php echo $row['bbcode_id'] ?>"><?php echo $user->lang['EDIT'] ?></a> | <a href="admin_bbcodes.<?php echo $phpEx . $SID ?>&mode=delete&bbcode=<?php echo $row['bbcode_id'] ?>"><?php echo $user->lang['DELETE'] ?></a></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['ADD_BBCODE'] ?>" class="btnmain" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------
|
|
||||||
// Functions
|
|
||||||
function build_regexp($msg_bbcode, $msg_html)
|
|
||||||
{
|
|
||||||
$msg_bbcode = trim($msg_bbcode);
|
|
||||||
$msg_html = trim($msg_html);
|
|
||||||
|
|
||||||
$fp_match = preg_quote($msg_bbcode, '!');
|
|
||||||
$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $msg_bbcode);
|
|
||||||
$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace);
|
|
||||||
|
|
||||||
$sp_match = preg_quote($msg_bbcode, '!');
|
|
||||||
$sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match);
|
|
||||||
$sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match);
|
|
||||||
$sp_replace = $msg_html;
|
|
||||||
|
|
||||||
$tokens = array(
|
|
||||||
'URL' => array(
|
|
||||||
'!([a-z0-9]+://)?([^?].*?[^ \t\n\r<"]*)!ie' => "(('\$1') ? '\$1\$2' : 'http://\$2')"
|
|
||||||
),
|
|
||||||
'LOCAL_URL' => array(
|
|
||||||
'!([^:]+/[^ \t\n\r<"]*)!' => '$1'
|
|
||||||
),
|
|
||||||
'EMAIL' => array(
|
|
||||||
'!([a-z0-9]+[a-z0-9\-\._]*@(?:(?:[0-9]{1,3}\.){3,5}[0-9]{1,3}|[a-z0-9]+[a-z0-9\-\._]*\.[a-z]+))!i' => '$1'
|
|
||||||
),
|
|
||||||
'TEXT' => array(
|
|
||||||
'!(.*?)!es' => "str_replace('\\\"', '"', str_replace('\\'', ''', '\$1'))"
|
|
||||||
),
|
|
||||||
'COLOR' => array(
|
|
||||||
'!([a-z]+|#[0-9abcdef]+!i' => '$1'
|
|
||||||
),
|
|
||||||
'NUMBER' => array(
|
|
||||||
'!([0-9]+)!' => '$1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $msg_bbcode, $m))
|
|
||||||
{
|
|
||||||
$pad = 0;
|
|
||||||
$modifiers = 'i';
|
|
||||||
|
|
||||||
foreach ($m[0] as $n => $token)
|
|
||||||
{
|
|
||||||
$token_type = $m[1][$n];
|
|
||||||
|
|
||||||
reset($tokens[$token_type]);
|
|
||||||
list($match, $replace) = each($tokens[$token_type]);
|
|
||||||
|
|
||||||
// Pad backreference numbers from tokens
|
|
||||||
if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
|
|
||||||
{
|
|
||||||
$repad = $pad + count(array_unique($repad[0]));
|
|
||||||
$replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\$' . (\$1 + \$pad)", $replace);
|
|
||||||
$pad = $repad;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtain pattern modifiers to use and alter the regex accordingly
|
|
||||||
$regex = preg_replace('/!(.*)!([a-z]*)/', '$1', $match);
|
|
||||||
$regex_modifiers = preg_replace('/!(.*)!([a-z]*)/', '$2', $match);
|
|
||||||
|
|
||||||
for ($i = 0; $i < strlen($regex_modifiers); ++$i)
|
|
||||||
{
|
|
||||||
if (strpos($modifiers, $regex_modifiers[$i]) === FALSE)
|
|
||||||
{
|
|
||||||
$modifiers .= $regex_modifiers[$i];
|
|
||||||
|
|
||||||
if ($regex_modifiers[$i] == 'e')
|
|
||||||
{
|
|
||||||
$fp_replace = "'" . str_replace("'", "\\'", $fp_replace) . "'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($regex_modifiers[$i] == 'e')
|
|
||||||
{
|
|
||||||
$replace = "'.$replace.'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match);
|
|
||||||
$fp_replace = str_replace($token, $replace, $fp_replace);
|
|
||||||
|
|
||||||
$sp_match = str_replace(preg_quote($token, '!'), '(.*?)', $sp_match);
|
|
||||||
$sp_replace = str_replace($token, '$' . ($n + 1), $sp_replace);
|
|
||||||
}
|
|
||||||
|
|
||||||
$fp_match = '!' . $fp_match . '!' . $modifiers;
|
|
||||||
$sp_match = '!' . $sp_match . '!s';
|
|
||||||
|
|
||||||
if (strpos($fp_match, 'e') !== FALSE)
|
|
||||||
{
|
|
||||||
$fp_replace = str_replace("'.'", '', $fp_replace);
|
|
||||||
$fp_replace = str_replace(".''.", '.', $fp_replace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No replacement is present, no need for a second-pass pattern replacement
|
|
||||||
// A simple str_replace will suffice
|
|
||||||
$fp_match = '!' . $fp_match . '!' . $modifiers;
|
|
||||||
$sp_match = $fp_replace;
|
|
||||||
$sp_replace = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lowercase tags
|
|
||||||
$bbcode_tag = preg_replace('/.*?\[([a-z]+).*/i', '$1', $msg_bbcode);
|
|
||||||
$fp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_match);
|
|
||||||
$fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace);
|
|
||||||
$sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match);
|
|
||||||
$sp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_replace);
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'bbcode_tag' => $bbcode_tag,
|
|
||||||
'first_pass_match' => $fp_match,
|
|
||||||
'first_pass_replace' => $fp_replace,
|
|
||||||
'second_pass_match' => $sp_match,
|
|
||||||
'second_pass_replace' => $sp_replace
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// End Functions
|
|
||||||
// -----------------------------
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,517 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
$filename = basename(__FILE__);
|
|
||||||
$module['GENERAL']['AUTH_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=auth" : '';
|
|
||||||
$module['GENERAL']['AVATAR_SETTINGS'] = ($auth->acl_get('a_board')) ? "$filename$SID&mode=avatar" : '';
|
|
||||||
$module['GENERAL']['BOARD_DEFAULTS'] = ($auth->acl_get('a_defaults')) ? "$filename$SID&mode=default" : '';
|
|
||||||
$module['GENERAL']['BOARD_SETTINGS'] = ($auth->acl_get('a_board')) ? "$filename$SID&mode=setting" : '';
|
|
||||||
$module['GENERAL']['COOKIE_SETTINGS'] = ($auth->acl_get('a_cookies')) ? "$filename$SID&mode=cookie" : '';
|
|
||||||
$module['GENERAL']['EMAIL_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=email" : '';
|
|
||||||
$module['GENERAL']['LOAD_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=load" : '';
|
|
||||||
$module['GENERAL']['SERVER_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=server" : '';
|
|
||||||
$module['GENERAL']['MESSAGE_SETTINGS'] = ($auth->acl_get('a_defaults')) ? "$filename$SID&mode=message" : '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Load default header
|
|
||||||
$phpbb_root_path = '../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
// Get mode
|
|
||||||
$mode = request_var('mode', '');
|
|
||||||
$action = request_var('action', '');
|
|
||||||
$submit = (isset($_POST['submit'])) ? true : false;
|
|
||||||
|
|
||||||
// Set config vars
|
|
||||||
$display_vars = array(
|
|
||||||
'cookie' => array(
|
|
||||||
'auth' => 'a_cookies',
|
|
||||||
'title' => 'COOKIE_SETTINGS',
|
|
||||||
'vars' => array(
|
|
||||||
'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'type' => 'text::255', 'explain' => false),
|
|
||||||
'cookie_name' => array('lang' => 'COOKIE_NAME', 'type' => 'text::16', 'explain' => false),
|
|
||||||
'cookie_path' => array('lang' => 'COOKIE_PATH', 'type' => 'text::255', 'explain' => false),
|
|
||||||
'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:disabled_enabled', 'explain' => true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'avatar' => array(
|
|
||||||
'auth' => 'a_board',
|
|
||||||
'title' => 'AVATAR_SETTINGS',
|
|
||||||
'vars' => array(
|
|
||||||
'avatar_min_height' => false, 'avatar_min_width' => false, 'avatar_max_height' => false, 'avatar_max_width' => false,
|
|
||||||
|
|
||||||
'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
|
|
||||||
'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true),
|
|
||||||
'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true),
|
|
||||||
'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'type' => 'text:20:255', 'explain' => true),
|
|
||||||
'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'type' => 'text:20:255', 'explain' => true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'email' => array(
|
|
||||||
'auth' => 'a_server',
|
|
||||||
'title' => 'EMAIL_SETTINGS',
|
|
||||||
'vars' => array(
|
|
||||||
'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
|
||||||
'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
|
||||||
'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
|
||||||
'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'type' => 'text:20:50', 'explain' => true),
|
|
||||||
'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'type' => 'text:5:5', 'explain' => true),
|
|
||||||
'board_contact' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => true),
|
|
||||||
'board_email' => array('lang' => 'ADMIN_EMAIL', 'type' => 'text:25:100', 'explain' => true),
|
|
||||||
'board_email_sig' => array('lang' => 'EMAIL_SIG', 'type' => 'textarea:5:30', 'explain' => true),
|
|
||||||
'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false),
|
|
||||||
'smtp_port' => array('lang' => 'SMTP_PORT', 'type' => 'text:4:5', 'explain' => true),
|
|
||||||
'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => 'mail_auth_select(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'smtp_username' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true),
|
|
||||||
'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'load' => array(
|
|
||||||
'auth' => 'a_server',
|
|
||||||
'title' => 'SERVER_SETTINGS',
|
|
||||||
'vars' => array(
|
|
||||||
'limit_load' => array('lang' => 'LIMIT_LOAD', 'type' => 'text:4:4', 'explain' => true),
|
|
||||||
'session_length' => array('lang' => 'SESSION_LENGTH', 'type' => 'text:5:5', 'explain' => true),
|
|
||||||
'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'type' => 'text:4:4', 'explain' => true),
|
|
||||||
'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'load_online_guests'=> array('lang' => 'YES_ONLINE_GUESTS', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'type' => 'text:4:3', 'explain' => true),
|
|
||||||
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'load_search' => array('lang' => 'YES_SEARCH', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'search_interval' => array('lang' => 'SEARCH_INTERVAL', 'type' => 'text:3:4', 'explain' => true),
|
|
||||||
'min_search_chars' => array('lang' => 'MIN_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true),
|
|
||||||
'max_search_chars' => array('lang' => 'MAX_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true),
|
|
||||||
'load_search_upd' => array('lang' => 'YES_SEARCH_UPDATE', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
// 'load_search_phr' => array('lang' => 'YES_SEARCH_PHRASE', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'default' => array(
|
|
||||||
'auth' => 'a_defaults',
|
|
||||||
'title' => 'BOARD_DEFAULTS',
|
|
||||||
'vars' => array(
|
|
||||||
'default_style' => array('lang' => 'DEFAULT_STYLE', 'type' => 'select', 'options' => 'style_select(\'{VALUE}\', true)', 'explain' => false),
|
|
||||||
'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'type' => 'select', 'options' => 'language_select(\'{VALUE}\')', 'explain' => false),
|
|
||||||
'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'type' => 'text::255', 'explain' => true),
|
|
||||||
'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'type' => 'select', 'options' => 'tz_select(\'{VALUE}\')', 'explain' => false),
|
|
||||||
'board_dst' => array('lang' => 'SYSTEM_DST', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_privmsg' => array('lang' => 'BOARD_PM', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_html' => array('lang' => 'ALLOW_HTML', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_html_tags' => array('lang' => 'ALLOWED_TAGS', 'type' => 'text:30:255', 'explain' => true),
|
|
||||||
'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_sig' => array('lang' => 'ALLOW_SIG', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'type' => 'text:5:4', 'explain' => true),
|
|
||||||
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'type' => 'radio:yes_no', 'explain' => true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'message' => array(
|
|
||||||
'auth' => 'a_defaults',
|
|
||||||
'title' => 'MESSAGE_SETTINGS',
|
|
||||||
'lang' => 'ucp',
|
|
||||||
'vars' => array(
|
|
||||||
'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'type' => 'text:4:4', 'explain' => true),
|
|
||||||
'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'type' => 'text:4:4', 'explain' => true),
|
|
||||||
'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'type' => 'select', 'options' => 'full_folder_select(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true),
|
|
||||||
'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'auth_html_pm' => array('lang' => 'ALLOW_HTML_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'auth_download_pm' => array('lang' => 'ALLOW_DOWNLOAD_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'auth_report_pm' => array('lang' => 'ALLOW_REPORT_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'email_pm' => array('lang' => 'ALLOW_EMAIL_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'type' => 'radio:yes_no', 'explain' => false)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'server' => array(
|
|
||||||
'auth' => 'a_server',
|
|
||||||
'title' => 'SERVER_SETTINGS',
|
|
||||||
'vars' => array(
|
|
||||||
'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true),
|
|
||||||
'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true),
|
|
||||||
'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true),
|
|
||||||
'ip_check' => array('lang' => 'IP_VALID', 'type' => 'custom', 'options' => 'select_ip_check(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'browser_check' => array('lang' => 'BROWSER_VALID', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'type' => 'radio:yes_no', 'explain' => false),
|
|
||||||
'smilies_path' => array('lang' => 'SMILIES_PATH', 'type' => 'text:20:255', 'explain' => true),
|
|
||||||
'icons_path' => array('lang' => 'ICONS_PATH', 'type' => 'text:20:255', 'explain' => true),
|
|
||||||
'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'type' => 'text:20:255', 'explain' => true),
|
|
||||||
'ranks_path' => array('lang' => 'RANKS_PATH', 'type' => 'text:20:255', 'explain' => true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'setting' => array(
|
|
||||||
'auth' => 'a_board',
|
|
||||||
'title' => 'BOARD_SETTINGS',
|
|
||||||
'vars' => array(
|
|
||||||
'board_disable_msg' => false, 'max_name_chars' => false, 'max_pass_chars' => false, 'bump_type' => false,
|
|
||||||
|
|
||||||
'sitename' => array('lang' => 'SITE_NAME', 'type' => 'text:40:255', 'explain' => false),
|
|
||||||
'site_desc' => array('lang' => 'SITE_DESC', 'type' => 'text:40:255', 'explain' => false),
|
|
||||||
'board_disable' => array('lang' => 'DISABLE_BOARD', 'type' => 'custom', 'options' => 'board_disable(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'require_activation'=> array('lang' => 'ACC_ACTIVATION', 'type' => 'custom', 'options' => 'select_acc_activation(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'max_autologin_time'=> array('lang' => 'AUTOLOGIN_LENGTH', 'type' => 'text:3:3', 'explain' => true),
|
|
||||||
'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'coppa_fax' => array('lang' => 'COPPA_FAX', 'type' => 'text:25:100', 'explain' => false),
|
|
||||||
'coppa_mail' => array('lang' => 'COPPA_MAIL', 'type' => 'textarea:5:40', 'explain' => true),
|
|
||||||
'enable_confirm' => array('lang' => 'VISUAL_CONFIRM', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'type' => 'text:4:4', 'explain' => true),
|
|
||||||
'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'type' => 'custom', 'options' => 'username_length(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'type' => 'select', 'options' => 'select_username_chars(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'type' => 'custom', 'options' => 'password_length(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'type' => 'select', 'options' => 'select_password_chars(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'type' => 'text:3:3', 'explain' => true),
|
|
||||||
'save_passwd' => array('lang' => 'SAVE_PASSWORDS', 'type' => 'text:2:2', 'explain' => true),
|
|
||||||
'max_login_attempts'=> array('lang' => 'LOGIN_LIMIT', 'type' => 'text:4:4', 'explain' => true),
|
|
||||||
'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true),
|
|
||||||
'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true),
|
|
||||||
'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'type' => 'text:3:4', 'explain' => true),
|
|
||||||
'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'type' => 'custom', 'options' => 'bump_interval(\'{VALUE}\')', 'explain' => true),
|
|
||||||
'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false),
|
|
||||||
'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false),
|
|
||||||
'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'type' => 'text:3:4', 'explain' => false),
|
|
||||||
'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'type' => 'text:4:4', 'explain' => false),
|
|
||||||
'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'type' => 'text:4:6', 'explain' => true),
|
|
||||||
'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'type' => 'text:4:4', 'explain' => true),
|
|
||||||
'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'type' => 'text:4:4', 'explain' => true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'auth' => array(
|
|
||||||
'auth' => 'a_server',
|
|
||||||
'title' => 'AUTH_SETTINGS',
|
|
||||||
'vars' => array(
|
|
||||||
'auth_method' => array('lang' => 'AUTH_METHOD', 'type' => 'select', 'options' => 'select_auth_method(\'{VALUE}\')', 'explain' => false)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!in_array($mode, array_keys($display_vars)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform the current mode
|
|
||||||
$display_vars = $display_vars[$mode];
|
|
||||||
|
|
||||||
// Check permissions
|
|
||||||
if (!$auth->acl_get($display_vars['auth']))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($display_vars['lang']))
|
|
||||||
{
|
|
||||||
$user->add_lang($display_vars['lang']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$new = $config;
|
|
||||||
$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $new;
|
|
||||||
|
|
||||||
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
|
|
||||||
foreach ($display_vars['vars'] as $config_name => $null)
|
|
||||||
{
|
|
||||||
if (!isset($cfg_array[$config_name]))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$config_value = $cfg_array[$config_name];
|
|
||||||
$new[$config_name] = $config_value;
|
|
||||||
|
|
||||||
if ($config_name == 'email_function_name')
|
|
||||||
{
|
|
||||||
$new['email_function_name'] = (empty($new['email_function_name']) || !function_exists($new['email_function_name'])) ? 'mail' : str_replace(array('(', ')'), array('', ''), trim($new['email_function_name']));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($submit)
|
|
||||||
{
|
|
||||||
set_config($config_name, $config_value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($submit)
|
|
||||||
{
|
|
||||||
add_log('admin', 'LOG_' . strtoupper($mode) . '_CONFIG');
|
|
||||||
|
|
||||||
trigger_error($user->lang['CONFIG_UPDATED']);
|
|
||||||
}
|
|
||||||
|
|
||||||
adm_page_header($user->lang[$display_vars['title']]);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang[$display_vars['title']]; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang[$display_vars['title'] . '_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form action="<?php echo "admin_board.$phpEx$SID&mode=$mode"; ?>" method="post"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang[$display_vars['title']]; ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Output relevant page
|
|
||||||
foreach ($display_vars['vars'] as $config_key => $vars)
|
|
||||||
{
|
|
||||||
if (!is_array($vars))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = explode(':', $vars['type']);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="50%"><b><?php echo $user->lang[$vars['lang']]; ?>: </b><?php echo ($vars['explain']) ? '<br /><span class="gensmall">' . $user->lang[$vars['lang'] . '_EXPLAIN'] . '</span>' : ''; ?></td>
|
|
||||||
<td class="row2"><?php echo build_cfg_template($type, $config_key, ((isset($vars['options'])) ? $vars['options'] : '')) . ((isset($vars['append'])) ? str_replace('{VALUE}', $new[$config_key], $vars['append']) : ''); ?></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
unset($display_vars['vars'][$config_key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($mode == 'auth')
|
|
||||||
{
|
|
||||||
$auth_plugins = array();
|
|
||||||
|
|
||||||
$dp = opendir($phpbb_root_path . 'includes/auth');
|
|
||||||
while ($file = readdir($dp))
|
|
||||||
{
|
|
||||||
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
|
|
||||||
{
|
|
||||||
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sort($auth_plugins);
|
|
||||||
|
|
||||||
foreach ($auth_plugins as $method)
|
|
||||||
{
|
|
||||||
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
|
|
||||||
{
|
|
||||||
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
|
|
||||||
|
|
||||||
$method = 'admin_' . $method;
|
|
||||||
if (function_exists($method))
|
|
||||||
{
|
|
||||||
if ($config_fields = $method($new))
|
|
||||||
{
|
|
||||||
// Check if we need to create config fields for this plugin
|
|
||||||
foreach ($config_fields as $field)
|
|
||||||
{
|
|
||||||
if (!isset($config[$field]))
|
|
||||||
{
|
|
||||||
set_config($field, '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($config_fields);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
function select_auth_method($selected_method)
|
|
||||||
{
|
|
||||||
global $new, $phpbb_root_path, $phpEx;
|
|
||||||
|
|
||||||
$auth_plugins = array();
|
|
||||||
|
|
||||||
$dp = opendir($phpbb_root_path . 'includes/auth');
|
|
||||||
while ($file = readdir($dp))
|
|
||||||
{
|
|
||||||
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
|
|
||||||
{
|
|
||||||
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sort($auth_plugins);
|
|
||||||
|
|
||||||
$auth_select = '';
|
|
||||||
foreach ($auth_plugins as $method)
|
|
||||||
{
|
|
||||||
$selected = ($selected_method == $method) ? ' selected="selected"' : '';
|
|
||||||
$auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $auth_select;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mail_auth_select($selected_method)
|
|
||||||
{
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
$auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
|
|
||||||
$s_smtp_auth_options = '';
|
|
||||||
|
|
||||||
foreach ($auth_methods as $method)
|
|
||||||
{
|
|
||||||
$s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $s_smtp_auth_options;
|
|
||||||
}
|
|
||||||
|
|
||||||
function full_folder_select($value)
|
|
||||||
{
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES'] . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function select_ip_check($value)
|
|
||||||
{
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
$ip_all = ($value == 4) ? ' checked="checked"' : '';
|
|
||||||
$ip_classc = ($value == 3) ? ' checked="checked"' : '';
|
|
||||||
$ip_classb = ($value == 2) ? ' checked="checked"' : '';
|
|
||||||
$ip_none = ($value == 0) ? ' checked="checked"' : '';
|
|
||||||
|
|
||||||
$options = <<<EOT
|
|
||||||
<input type="radio" name="config[ip_check]" value="4"$ip_all /> {$user->lang['ALL']} <input type="radio" name="config[ip_check]" value="3"$ip_classc /> {$user->lang['CLASS_C']} <input type="radio" name="config[ip_check]" value="2"$ip_classb /> {$user->lang['CLASS_B']} <input type="radio" name="config[ip_check]" value="0"$ip_none /> {$user->lang['NONE']}
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
return $options;
|
|
||||||
}
|
|
||||||
|
|
||||||
function select_acc_activation($value)
|
|
||||||
{
|
|
||||||
global $user, $config;
|
|
||||||
|
|
||||||
$activation_none = ($value == USER_ACTIVATION_NONE) ? ' checked="checked"' : '';
|
|
||||||
$activation_user = ($value == USER_ACTIVATION_SELF) ? ' checked="checked"' : '';
|
|
||||||
$activation_admin = ($value == USER_ACTIVATION_ADMIN) ? ' checked="checked"' : '';
|
|
||||||
$activation_disable = ($value == USER_ACTIVATION_DISABLE) ? ' checked="checked"' : '';
|
|
||||||
|
|
||||||
$options = '<input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_NONE . '"' . $activation_none . ' /> ' . $user->lang['ACC_NONE'];
|
|
||||||
|
|
||||||
if ($config['email_enable'])
|
|
||||||
{
|
|
||||||
$options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_SELF . '"' . $activation_user . ' /> ' . $user->lang['ACC_USER'];
|
|
||||||
$options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_ADMIN . '"' . $activation_admin . ' /> ' . $user->lang['ACC_ADMIN'];
|
|
||||||
}
|
|
||||||
$options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_DISABLE . '"' . $activation_disable . ' /> ' . $user->lang['ACC_DISABLE'];
|
|
||||||
|
|
||||||
return $options;
|
|
||||||
}
|
|
||||||
|
|
||||||
function username_length($value)
|
|
||||||
{
|
|
||||||
global $new, $user;
|
|
||||||
|
|
||||||
return '<input class="post" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input class="post" type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $new['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
|
||||||
}
|
|
||||||
|
|
||||||
function select_username_chars($selected_value)
|
|
||||||
{
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
$user_char_ary = array('USERNAME_CHARS_ANY' => '.*', 'USERNAME_ALPHA_ONLY' => '[\w]+', 'USERNAME_ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+');
|
|
||||||
$user_char_options = '';
|
|
||||||
foreach ($user_char_ary as $lang => $value)
|
|
||||||
{
|
|
||||||
$selected = ($selected_value == $value) ? ' selected="selected"' : '';
|
|
||||||
$user_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $user_char_options;
|
|
||||||
}
|
|
||||||
|
|
||||||
function password_length($value)
|
|
||||||
{
|
|
||||||
global $new, $user;
|
|
||||||
|
|
||||||
return '<input class="post" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input class="post" type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $new['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
|
||||||
}
|
|
||||||
|
|
||||||
function select_password_chars($selected_value)
|
|
||||||
{
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
$pass_type_ary = array('PASS_TYPE_ANY' => '.*', 'PASS_TYPE_CASE' => '[a-zA-Z]', 'PASS_TYPE_ALPHA' => '[a-zA-Z0-9]', 'PASS_TYPE_SYMBOL' => '[a-zA-Z\W]');
|
|
||||||
$pass_char_options = '';
|
|
||||||
foreach ($pass_type_ary as $lang => $value)
|
|
||||||
{
|
|
||||||
$selected = ($selected_value == $value) ? ' selected="selected"' : '';
|
|
||||||
$pass_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $pass_char_options;
|
|
||||||
}
|
|
||||||
|
|
||||||
function bump_interval($value)
|
|
||||||
{
|
|
||||||
global $new, $user;
|
|
||||||
|
|
||||||
$s_bump_type = '';
|
|
||||||
$types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS');
|
|
||||||
foreach ($types as $type => $lang)
|
|
||||||
{
|
|
||||||
$selected = ($new['bump_type'] == $type) ? 'selected="selected" ' : '';
|
|
||||||
$s_bump_type .= '<option value="' . $type . '" ' . $selected . '>' . $user->lang[$lang] . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<input class="post" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" /> <select name="config[bump_type]">' . $s_bump_type . '</select>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function board_disable($value)
|
|
||||||
{
|
|
||||||
global $new, $user;
|
|
||||||
|
|
||||||
$board_disable_yes = ($value) ? ' checked="checked"' : '';
|
|
||||||
$board_disable_no = (!$value) ? ' checked="checked"' : '';
|
|
||||||
|
|
||||||
return '<input type="radio" name="config[board_disable]" value="1"' . $board_disable_yes . ' /> ' . $user->lang['YES'] . ' <input type="radio" name="config[board_disable]" value="0"' . $board_disable_no . ' /> ' . $user->lang['NO'] . '<br /><input class="post" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $new['board_disable_msg'] . '" />';
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,394 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
if (!$auth->acl_get('a_server'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$module['USER']['BOTS'] = basename(__FILE__) . $SID;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Include files
|
|
||||||
$phpbb_root_path = '../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
// Do we have permission?
|
|
||||||
if (!$auth->acl_get('a_server'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set various vars
|
|
||||||
$submit = (isset($_POST['submit'])) ? true : false;
|
|
||||||
$action = request_var('action', '');
|
|
||||||
$mark = request_var('mark', 0);
|
|
||||||
$id = request_var('id', 0);
|
|
||||||
|
|
||||||
if (isset($_POST['add']))
|
|
||||||
{
|
|
||||||
$action = 'add';
|
|
||||||
}
|
|
||||||
|
|
||||||
$error = array();
|
|
||||||
|
|
||||||
// User wants to do something, how inconsiderate of them!
|
|
||||||
switch ($action)
|
|
||||||
{
|
|
||||||
case 'activate':
|
|
||||||
if ($id || $mark)
|
|
||||||
{
|
|
||||||
$id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')';
|
|
||||||
$sql = 'UPDATE ' . BOTS_TABLE . "
|
|
||||||
SET bot_active = 1
|
|
||||||
WHERE bot_id $id";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cache->destroy('bots');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'deactivate':
|
|
||||||
if ($id || $mark)
|
|
||||||
{
|
|
||||||
$id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')';
|
|
||||||
$sql = 'UPDATE ' . BOTS_TABLE . "
|
|
||||||
SET bot_active = 0
|
|
||||||
WHERE bot_id $id";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cache->destroy('bots');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'delete':
|
|
||||||
if ($id || $mark)
|
|
||||||
{
|
|
||||||
// We need to delete the relevant user, usergroup and bot entries ...
|
|
||||||
$id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')';
|
|
||||||
$sql = 'SELECT bot_name, user_id
|
|
||||||
FROM ' . BOTS_TABLE . "
|
|
||||||
WHERE bot_id $id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$user_id_ary = $bot_name_ary = array();
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$user_id_ary[] = (int) $row['user_id'];
|
|
||||||
$bot_name_ary[] = $row['bot_name'];
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$db->sql_transaction();
|
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . BOTS_TABLE . "
|
|
||||||
WHERE bot_id $id";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
foreach (array(USERS_TABLE, USER_GROUP_TABLE) as $table)
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM $table
|
|
||||||
WHERE user_id IN (" . implode(', ', $user_id_ary) . ')';
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->sql_transaction('commit');
|
|
||||||
|
|
||||||
$cache->destroy('bots');
|
|
||||||
|
|
||||||
add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary));
|
|
||||||
trigger_error($user->lang['BOT_DELETED']);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'edit':
|
|
||||||
case 'add':
|
|
||||||
$bot_name = request_var('bot_name', '');
|
|
||||||
$bot_agent = request_var('bot_agent', '');
|
|
||||||
$bot_ip = request_var('bot_ip', '');
|
|
||||||
$bot_active = request_var('bot_active', true);
|
|
||||||
$bot_lang = request_var('bot_lang', $config['default_lang']);
|
|
||||||
$bot_style = request_var('bot_style' , $config['default_style']);
|
|
||||||
|
|
||||||
if ($submit)
|
|
||||||
{
|
|
||||||
if (!$bot_agent && !$bot_ip)
|
|
||||||
{
|
|
||||||
$error[] = $user->lang['ERR_BOT_NO_MATCHES'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($bot_ip && !preg_match('#^[\d\.,:]+$#', $bot_ip))
|
|
||||||
{
|
|
||||||
if (!$ip_list = gethostbynamel($bot_ip))
|
|
||||||
{
|
|
||||||
$error[] = $user->lang['ERR_BOT_NO_IP'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$bot_ip = implode(',', $ip_list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$bot_ip = str_replace(' ', '', $bot_ip);
|
|
||||||
|
|
||||||
if (!sizeof($error))
|
|
||||||
{
|
|
||||||
$db->sql_transaction();
|
|
||||||
|
|
||||||
// New bot? Create a new user and group entry
|
|
||||||
if ($action == 'add')
|
|
||||||
{
|
|
||||||
$sql = 'SELECT group_id, group_colour
|
|
||||||
FROM ' . GROUPS_TABLE . "
|
|
||||||
WHERE group_name = 'BOTS'
|
|
||||||
AND group_type = " . GROUP_SPECIAL;
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if (!extract($db->sql_fetchrow($result)))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_GROUP']);
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
|
||||||
'group_id' => (int) $group_id,
|
|
||||||
'username' => (string) $bot_name,
|
|
||||||
'user_type' => (int) USER_IGNORE,
|
|
||||||
'user_colour' => (string) $group_colour,
|
|
||||||
'user_lang' => (string) $bot_lang,
|
|
||||||
'user_style' => (int) $bot_style,
|
|
||||||
'user_options' => 0)
|
|
||||||
);
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$user_id = $db->sql_nextid();
|
|
||||||
|
|
||||||
// Add to Bots usergroup
|
|
||||||
$sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
|
||||||
'user_id' => $user_id,
|
|
||||||
'group_id' => $group_id)
|
|
||||||
);
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
|
||||||
'user_id' => (int) $user_id,
|
|
||||||
'bot_name' => (string) $bot_name,
|
|
||||||
'bot_active' => (int) $bot_active,
|
|
||||||
'bot_agent' => (string) $bot_agent,
|
|
||||||
'bot_ip' => (string) $bot_ip,)
|
|
||||||
);
|
|
||||||
|
|
||||||
$log = 'ADDED';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql = 'SELECT user_id
|
|
||||||
FROM ' . BOTS_TABLE . "
|
|
||||||
WHERE bot_id = $id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if (!extract($db->sql_fetchrow($result)))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_BOT']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
|
||||||
'user_style' => (int) $bot_style,
|
|
||||||
'user_lang' => (string) $bot_lang,)
|
|
||||||
) . " WHERE user_id = $user_id";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
|
||||||
'bot_name' => (string) $bot_name,
|
|
||||||
'bot_active' => (int) $bot_active,
|
|
||||||
'bot_agent' => (string) $bot_agent,
|
|
||||||
'bot_ip' => (string) $bot_ip,)
|
|
||||||
) . " WHERE bot_id = $id";
|
|
||||||
|
|
||||||
$log = 'UPDATED';
|
|
||||||
}
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$db->sql_transaction('commit');
|
|
||||||
|
|
||||||
$cache->destroy('bots');
|
|
||||||
|
|
||||||
add_log('admin', 'LOG_BOT_' . $log, $bot_name);
|
|
||||||
trigger_error($user->lang['BOT_' . $log]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($id)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT b.*, u.user_lang, u.user_style
|
|
||||||
FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u
|
|
||||||
WHERE b.bot_id = $id
|
|
||||||
AND u.user_id = b.user_id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if (!extract($db->sql_fetchrow($result)))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_BOT']);
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$bot_lang = $user_lang;
|
|
||||||
$bot_style = $user_style;
|
|
||||||
}
|
|
||||||
|
|
||||||
$s_active_options = '';
|
|
||||||
foreach (array('0' => 'NO', '1' => 'YES') as $value => $lang)
|
|
||||||
{
|
|
||||||
$selected = ($bot_active == $value) ? ' selected="selected"' : '';
|
|
||||||
$s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$style_select = style_select($bot_style, true);
|
|
||||||
$lang_select = language_select($bot_lang);
|
|
||||||
|
|
||||||
$l_title = ($action == 'edit') ? 'EDIT' : 'ADD';
|
|
||||||
|
|
||||||
// Output relevant page
|
|
||||||
adm_page_header($user->lang['BOT_' . $l_title]);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang['BOT_' . $l_title]; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['BOT_EDIT_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="<?php echo "admin_bots.$phpEx$SID&action=$action&id=$id"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang['BOT_' . $l_title]; ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if (sizeof($error))
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="2" align="center"><span style="color:red"><?php echo implode('<br />', $error); ?></span></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_NAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_NAME_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="bot_name" size="30" maxlength="255" value="<?php echo $bot_name; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_STYLE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_STYLE_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><select name="bot_style"><?php echo $style_select; ?></select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_LANG']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_LANG_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><select name="bot_lang"><?php echo $lang_select; ?></select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_ACTIVE']; ?>: </b></td>
|
|
||||||
<td class="row2"><select name="bot_active"><?php echo $s_active_options; ?></select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_AGENT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_AGENT_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="bot_agent" size="30" maxlength="255" value="<?php echo $bot_agent; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_IP']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_IP_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="bot_ip" size="30" maxlength="255" value="<?php echo $bot_ip; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output relevant page
|
|
||||||
adm_page_header($user->lang['BOTS']);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang['BOTS']; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['BOTS_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="<?php "admin_bots.$phpEx$SID"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th nowrap="nowrap"><?php echo $user->lang['BOT_NAME']; ?></th>
|
|
||||||
<th nowrap="nowrap"><?php echo $user->lang['BOT_LAST_VISIT']; ?></th>
|
|
||||||
<th colspan="3" nowrap="nowrap"><?php echo $user->lang['OPTIONS']; ?></th>
|
|
||||||
<th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$s_options = '';
|
|
||||||
foreach (array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE') as $value => $lang)
|
|
||||||
{
|
|
||||||
$s_options .= '<option value="' . $value . '">' . $user->lang[$lang] . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit
|
|
||||||
FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . ' u
|
|
||||||
WHERE u.user_id = b.user_id
|
|
||||||
ORDER BY u.user_lastvisit DESC';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$row_class = '';
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
|
|
||||||
|
|
||||||
$active_lang = (!$row['bot_active']) ? 'BOT_ACTIVATE' : 'BOT_DEACTIVATE';
|
|
||||||
$active_value = (!$row['bot_active']) ? 'activate' : 'deactivate';
|
|
||||||
$id = $row['bot_id'];
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="<?php echo $row_class; ?>" width="50%"><?php echo $row['bot_name']; ?></td>
|
|
||||||
<td class="<?php echo $row_class; ?>" width="15%" align="center" nowrap="nowrap"> <?php echo ($row['user_lastvisit']) ? $user->format_date($row['user_lastvisit']) : $user->lang['BOT_NEVER']; ?> </td>
|
|
||||||
<td class="<?php echo $row_class; ?>" width="1%"align="center"> <a href="<?php echo "admin_bots.$phpEx$SID&id=$id&action=$active_value"; ?>"><?php echo $user->lang[$active_lang]; ?></a> </td>
|
|
||||||
<td class="<?php echo $row_class; ?>" width="1%" align="center"> <a href="<?php echo "admin_bots.$phpEx$SID&id=$id&action=edit"; ?>"><?php echo $user->lang['EDIT']; ?></a> </td>
|
|
||||||
<td class="<?php echo $row_class; ?>" width="1%" align="center"> <a href="<?php echo "admin_bots.$phpEx$SID&id=$id&action=delete"; ?>"><?php echo $user->lang['DELETE']; ?></a> </td>
|
|
||||||
<td class="<?php echo $row_class; ?>" width="1%" align="center"><input type="checkbox" name="mark[]" value="<?php echo $id; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="6"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
|
||||||
<tr>
|
|
||||||
<td><input class="btnlite" type="submit" name="add" value="<?php echo $user->lang['BOT_ADD']; ?>" /></td>
|
|
||||||
<td align="right"><select name="action"><?php echo $s_options; ?></select> <input class="btnlite" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,776 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
if (!$auth->acl_get('a_icons'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$filename = basename(__FILE__);
|
|
||||||
$module['POST']['SMILIES'] = "$filename$SID&mode=smilies";
|
|
||||||
$module['POST']['ICONS'] = "$filename$SID&mode=icons";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Include files
|
|
||||||
$phpbb_root_path = './../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
// Do we have general permissions?
|
|
||||||
if (!$auth->acl_get('a_icons'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Grab some basic parameters
|
|
||||||
$mode = request_var('mode', '');
|
|
||||||
$action = request_var('action', '');
|
|
||||||
$action = (isset($_POST['add'])) ? 'add' : $action;
|
|
||||||
$action = (isset($_POST['edit'])) ? 'edit' : $action;
|
|
||||||
$id = request_var('id', 0);
|
|
||||||
|
|
||||||
// What are we working on?
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'smilies':
|
|
||||||
$table = SMILIES_TABLE;
|
|
||||||
$lang = 'SMILIES';
|
|
||||||
$fields = 'smiley';
|
|
||||||
$img_path = $config['smilies_path'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'icons':
|
|
||||||
$table = ICONS_TABLE;
|
|
||||||
$lang = 'ICONS';
|
|
||||||
$fields = 'icons';
|
|
||||||
$img_path = $config['icons_path'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear some arrays
|
|
||||||
$_images = $_paks = array();
|
|
||||||
$notice = '';
|
|
||||||
|
|
||||||
|
|
||||||
// Grab file list of paks and images
|
|
||||||
if ($action == 'edit' || $action == 'add' || $action == 'import')
|
|
||||||
{
|
|
||||||
$imglist = filelist($phpbb_root_path . $img_path, '');
|
|
||||||
|
|
||||||
foreach ($imglist as $path => $img_ary)
|
|
||||||
{
|
|
||||||
foreach ($img_ary as $img)
|
|
||||||
{
|
|
||||||
$img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
|
|
||||||
|
|
||||||
$_images[$path.$img]['file'] = $path.$img;
|
|
||||||
$_images[$path.$img]['width'] = $img_size[0];
|
|
||||||
$_images[$path.$img]['height'] = $img_size[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($imglist);
|
|
||||||
|
|
||||||
$dir = @opendir($phpbb_root_path . $img_path);
|
|
||||||
while ($file = @readdir($dir))
|
|
||||||
{
|
|
||||||
if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file))
|
|
||||||
{
|
|
||||||
$_paks[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@closedir($dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// What shall we do today? Oops, I believe that's trademarked ...
|
|
||||||
switch ($action)
|
|
||||||
{
|
|
||||||
case 'edit':
|
|
||||||
unset($_images);
|
|
||||||
$_images = array();
|
|
||||||
|
|
||||||
case 'add':
|
|
||||||
|
|
||||||
$order_list = '';
|
|
||||||
|
|
||||||
$sql = "SELECT *
|
|
||||||
FROM $table
|
|
||||||
ORDER BY {$fields}_order " . (($id || $action == 'add') ? 'DESC' : 'ASC');
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if ($action == 'add')
|
|
||||||
{
|
|
||||||
unset($_images[$row[$fields . '_url']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($row[$fields . '_id'] == $id)
|
|
||||||
{
|
|
||||||
$after = TRUE;
|
|
||||||
$data[$row[$fields . '_url']] = $row;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($action == 'edit' && !$id)
|
|
||||||
{
|
|
||||||
$data[$row[$fields . '_url']] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
$selected = '';
|
|
||||||
if (!empty($after))
|
|
||||||
{
|
|
||||||
$selected = ' selected="selected"';
|
|
||||||
$after = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
$after_txt = ($mode == 'smilies') ? $row['code'] : $row['icons_url'];
|
|
||||||
$order_list = '<option value="' . ($row[$fields . '_order']) . '"' . $selected . '>' . sprintf($user->lang['AFTER_' . $lang], ' -> ' . htmlspecialchars($after_txt)) . '</option>' . $order_list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ($row = $db->sql_fetchrow($result));
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . $user->lang['FIRST'] . '</option>' . $order_list;
|
|
||||||
|
|
||||||
if ($action == 'add')
|
|
||||||
{
|
|
||||||
$data = $_images;
|
|
||||||
}
|
|
||||||
|
|
||||||
$colspan = (($mode == 'smilies') ? '7' : '5');
|
|
||||||
$colspan += ($id) ? 1 : 0;
|
|
||||||
$colspan += ($action == 'add') ? 2 : 0;
|
|
||||||
|
|
||||||
adm_page_header($user->lang[$lang]);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang[$lang]; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="admin_icons.<?php echo $phpEx . $SID . "&mode=$mode&action=" . (($action == 'add') ? 'create' : 'modify'); ?>">
|
|
||||||
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="<?php echo $colspan; ?>"><?php echo $user->lang[$lang . '_CONFIG'] ?></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat"><?php echo $user->lang[$lang . '_URL'] ?></td>
|
|
||||||
<td class="cat"><?php echo $user->lang[$lang . '_LOCATION'] ?></td>
|
|
||||||
<?php
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<td class="cat"><?php echo $user->lang[$lang . '_CODE'] ?></td>
|
|
||||||
<td class="cat"><?php echo $user->lang[$lang . '_EMOTION'] ?></td>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<td class="cat"><?php echo $user->lang[$lang . '_WIDTH'] ?></td>
|
|
||||||
<td class="cat"><?php echo $user->lang[$lang . '_HEIGHT'] ?></td>
|
|
||||||
<td class="cat"><?php echo $user->lang['DISPLAY_ON_POSTING'] ?></td>
|
|
||||||
<?php
|
|
||||||
if ($id || $action == 'add')
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<td class="cat"><?php echo $user->lang[$lang . '_ORDER'] ?></td>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
if ($action == 'add')
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<td class="cat"><?php echo $user->lang['ADD'] ?></td>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
$row = 0;
|
|
||||||
foreach ($data as $img => $img_row)
|
|
||||||
{
|
|
||||||
$row_class = (($row % 2) == 0) ? 'row1' : 'row2';
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td align="center" class="<?php echo $row_class; ?>"><img src="<?php echo $phpbb_root_path . $img_path . '/' . $img ?>" border="0" alt="" title="" /><input type="hidden" name="image[<?php echo $img; ?>]" value="1" /></td>
|
|
||||||
<td valign="top" class="<?php echo $row_class; ?>">[<?php echo $img; ?>]</td>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<td class="<?php echo $row_class; ?>"><input class="post" type="text" name="code[<?php echo $img; ?>]" value="<?php echo (!empty($img_row['code'])) ? $img_row['code'] : '' ?>" size="10" /></td>
|
|
||||||
<td class="<?php echo $row_class; ?>"><input class="post" type="text" name="emotion[<?php echo $img; ?>]" value="<?php echo (!empty($img_row['emotion'])) ? $img_row['emotion'] : '' ?>" size="10" /></td>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<td class="<?php echo $row_class; ?>"><input class="post" type="text" size="3" name="width[<?php echo $img; ?>]" value="<?php echo (!empty($img_row[$fields .'_width'])) ? $img_row[$fields .'_width'] : $img_row['width'] ?>" /></td>
|
|
||||||
<td class="<?php echo $row_class; ?>"><input class="post" type="text" size="3" name="height[<?php echo $img; ?>]" value="<?php echo (!empty($img_row[$fields .'_height'])) ? $img_row[$fields .'_height'] : $img_row['height'] ?>" /></td>
|
|
||||||
<td class="<?php echo $row_class; ?>"><input type="checkbox" name="display_on_posting[<?php echo $img; ?>]"<?php echo (!empty($img_row['display_on_posting']) || $action == 'add') ? ' checked="checked"' : '' ?> /></td>
|
|
||||||
<?php
|
|
||||||
if ($id || $action == 'add')
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<td class="<?php echo $row_class; ?>"><select name="order[<?php echo $img; ?>]"><?php echo $order_list ?></select></td>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'add')
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<td class="<?php echo $row_class; ?>"><input type="checkbox" name="add_img[<?php echo $img; ?>]" value="1" /><?php
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
if (isset($img_row[$fields . '_id']))
|
|
||||||
{
|
|
||||||
|
|
||||||
?><input type="hidden" name="id[<?php echo $img; ?>]" value="<?php echo $img_row[$fields . '_id'] ?>" /><?php
|
|
||||||
|
|
||||||
}
|
|
||||||
$row++;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="<?php echo $colspan; ?>" align="center"><?php
|
|
||||||
|
|
||||||
|
|
||||||
?><input class="btnmain" type="submit" value="<?php echo $user->lang['SUBMIT'] ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'create':
|
|
||||||
case 'modify':
|
|
||||||
|
|
||||||
// Get items to create/modify
|
|
||||||
$images = (isset($_POST['image'])) ? array_keys($_POST['image']) : array();
|
|
||||||
|
|
||||||
// Now really get the items
|
|
||||||
$image_id = (isset($_POST['id'])) ? array_map('intval', $_POST['id']) : array();
|
|
||||||
$image_order = (isset($_POST['order'])) ? array_map('intval', $_POST['order']) : array();
|
|
||||||
$image_width = (isset($_POST['width'])) ? array_map('intval', $_POST['width']) : array();
|
|
||||||
$image_height = (isset($_POST['height'])) ? array_map('intval', $_POST['height']) : array();
|
|
||||||
$image_add = (isset($_POST['add_img'])) ? array_map('intval', $_POST['add_img']) : array();
|
|
||||||
$image_emotion = request_var('emotion', '');
|
|
||||||
$image_code = request_var('code', '');
|
|
||||||
$image_display_on_posting = (isset($_POST['display_on_posting'])) ? array_map('intval', $_POST['display_on_posting']) : array();
|
|
||||||
|
|
||||||
foreach ($images as $image)
|
|
||||||
{
|
|
||||||
if (($mode == 'smilies' && ($image_emotion[$image] == '' || $image_code[$image] == '')) ||
|
|
||||||
($action == 'create' && !isset($image_add[$image])))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($image_width[$image] == 0 || $image_height[$image] == 0)
|
|
||||||
{
|
|
||||||
$img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $image);
|
|
||||||
$image_width[$image] = $img_size[0];
|
|
||||||
$image_height[$image] = $img_size[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$img_sql = array(
|
|
||||||
$fields . '_url' => $image,
|
|
||||||
$fields . '_width' => $image_width[$image],
|
|
||||||
$fields . '_height' => $image_height[$image],
|
|
||||||
'display_on_posting'=> (isset($image_display_on_posting[$image])) ? 1 : 0,
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
$img_sql = array_merge($img_sql, array(
|
|
||||||
'emotion' => $image_emotion[$image],
|
|
||||||
'code' => $image_code[$image])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($image_order[$image]))
|
|
||||||
{
|
|
||||||
$img_sql = array_merge($img_sql, array(
|
|
||||||
$fields . '_order' => $image_order[$image] . '.5')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'modify')
|
|
||||||
{
|
|
||||||
$sql = "UPDATE $table
|
|
||||||
SET " . $db->sql_build_array('UPDATE', $img_sql) . "
|
|
||||||
WHERE {$fields}_id = " . $image_id[$image];
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql = "INSERT INTO $table " . $db->sql_build_array('INSERT', $img_sql);
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$update = FALSE;
|
|
||||||
|
|
||||||
if ($action == 'modify' && !empty($image_order[$image]))
|
|
||||||
{
|
|
||||||
$update = TRUE;
|
|
||||||
|
|
||||||
$result = $db->sql_query("SELECT {$fields}_order
|
|
||||||
FROM $table
|
|
||||||
WHERE {$fields}_id = " . $image_id[$image]);
|
|
||||||
$order_old = $db->sql_fetchfield($fields . '_order', 0, $result);
|
|
||||||
|
|
||||||
if ($order_old == $image_order[$image])
|
|
||||||
{
|
|
||||||
$update = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($order_old > $image_order[$image])
|
|
||||||
{
|
|
||||||
$sign = '+';
|
|
||||||
$where = $fields . '_order >= ' . $image_order[$image] . " AND {$fields}_order < $order_old";
|
|
||||||
}
|
|
||||||
else if ($order_old < $image_order[$image])
|
|
||||||
{
|
|
||||||
$sign = '-';
|
|
||||||
$where = "{$fields}_order > $order_old AND {$fields}_order < " . $image_order[$image];
|
|
||||||
$sql[$fields . '_order'] = $image_order[$image] - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update)
|
|
||||||
{
|
|
||||||
$sql = "UPDATE $table
|
|
||||||
SET {$fields}_order = {$fields}_order $sign 1
|
|
||||||
WHERE $where";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$cache->destroy('icons');
|
|
||||||
|
|
||||||
if ($action == 'modify')
|
|
||||||
{
|
|
||||||
trigger_error($user->lang[$lang . '_EDITED']);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trigger_error($user->lang[$lang . '_ADDED']);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'import':
|
|
||||||
|
|
||||||
$pak = request_var('pak', '');
|
|
||||||
$current = request_var('current', '');
|
|
||||||
|
|
||||||
if ($pak != '')
|
|
||||||
{
|
|
||||||
$order = 0;
|
|
||||||
|
|
||||||
// The user has already selected a smilies_pak file
|
|
||||||
if ($current == 'delete')
|
|
||||||
{
|
|
||||||
$db->sql_query("TRUNCATE $table");
|
|
||||||
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'smilies':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'icons':
|
|
||||||
// Reset all icon_ids
|
|
||||||
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
|
|
||||||
SET icon_id = 0');
|
|
||||||
$db->sql_query('UPDATE ' . POSTS_TABLE . '
|
|
||||||
SET icon_id = 0');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$cur_img = array();
|
|
||||||
|
|
||||||
$field_sql = ($mode == 'smilies') ? 'code' : 'icons_url';
|
|
||||||
$result = $db->sql_query("SELECT $field_sql FROM $table");
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
++$order;
|
|
||||||
$cur_img[$row[$field_sql]] = 1;
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!($pak_ary = @file($phpbb_root_path . $img_path . '/' . $pak)))
|
|
||||||
{
|
|
||||||
trigger_error('Could not read pak file', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($pak_ary as $pak_entry)
|
|
||||||
{
|
|
||||||
$data = array();
|
|
||||||
if (preg_match_all("#'(.*?)', #", $pak_entry, $data))
|
|
||||||
{
|
|
||||||
if ((sizeof($data[1]) != 3 && $mode == 'icons') ||
|
|
||||||
(sizeof($data[1]) != 5 && $mode == 'smilies'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['WRONG_PAK_TYPE']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$img = stripslashes($data[1][0]);
|
|
||||||
$width = stripslashes($data[1][1]);
|
|
||||||
$height = stripslashes($data[1][2]);
|
|
||||||
if (isset($data[1][3]) && isset($data[1][4]))
|
|
||||||
{
|
|
||||||
$emotion = stripslashes($data[1][3]);
|
|
||||||
$code = htmlentities(stripslashes($data[1][4]));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($current == 'replace' &&
|
|
||||||
(($mode == 'smilies' && !empty($cur_img[$code])) ||
|
|
||||||
($mode == 'icons' && !empty($cur_img[$img]))))
|
|
||||||
{
|
|
||||||
$replace_sql = ($mode == 'smilies') ? $code : $img;
|
|
||||||
$sql = array(
|
|
||||||
$fields . '_url' => $img,
|
|
||||||
$fields . '_height' => (int) $height,
|
|
||||||
$fields . '_width' => (int) $width,
|
|
||||||
);
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
$sql = array_merge($sql, array(
|
|
||||||
'emotion' => $emotion
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->sql_query("UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . "
|
|
||||||
WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++$order;
|
|
||||||
|
|
||||||
$sql = array(
|
|
||||||
$fields . '_url' => $img,
|
|
||||||
$fields . '_height' => (int) $height,
|
|
||||||
$fields . '_width' => (int) $width,
|
|
||||||
$fields . '_order' => (int) $order,
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
$sql = array_merge($sql, array(
|
|
||||||
'code' => $code,
|
|
||||||
'emotion' => $emotion
|
|
||||||
));
|
|
||||||
}
|
|
||||||
$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$cache->destroy('icons');
|
|
||||||
trigger_error($user->lang[$lang . '_IMPORT_SUCCESS']);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$pak_options = '';
|
|
||||||
|
|
||||||
foreach ($_paks as $pak)
|
|
||||||
{
|
|
||||||
$pak_options .= '<option value="' . $pak . '">' . htmlspecialchars($pak) . '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
adm_page_header($user->lang[$lang]);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<h1><?php echo $user->lang[$lang] ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang[$lang .'_EXPLAIN'] ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=import'; ?>">
|
|
||||||
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang[$lang . '_IMPORT'] ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if ($pak_options == '')
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" colspan="2"><?php echo $user->lang['NO_' . $lang . '_PAK']; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row2"><?php echo $user->lang['SELECT_PACKAGE'] ?></td>
|
|
||||||
<td class="row1"><select name="pak"><?php echo $pak_options ?></select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row2"><?php echo $user->lang['CURRENT_' . $lang] ?><br /><span class="gensmall"><?php echo $user->lang['CURRENT_' . $lang . '_EXPLAIN'] ?></span></td>
|
|
||||||
<td class="row1"><input type="radio" name="current" value="keep" checked="checked" /> <?php echo $user->lang['KEEP_ALL'] ?> <input type="radio" name="current" value="replace" /> <?php echo $user->lang['REPLACE_MATCHES'] ?> <input type="radio" name="current" value="delete" /> <?php echo $user->lang['DELETE_ALL'] ?> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><input class="btnmain" name="import" type="submit" value="<?php echo $user->lang['IMPORT_' . $lang] ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
</table></form>
|
|
||||||
<?php
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'export':
|
|
||||||
|
|
||||||
adm_page_header($user->lang['EXPORT_' . $lang]);
|
|
||||||
trigger_error(sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '<a href="admin_icons.' . $phpEx . $SID . '&mode=' . $mode . '&action=send">', '</a>'));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'send':
|
|
||||||
|
|
||||||
$sql = "SELECT *
|
|
||||||
FROM $table
|
|
||||||
ORDER BY {$fields}_order";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$pak = '';
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$pak .= "'" . addslashes($row[$fields . '_url']) . "', ";
|
|
||||||
$pak .= "'" . addslashes($row[$fields . '_height']) . "', ";
|
|
||||||
$pak .= "'" . addslashes($row[$fields . '_width']) . "', ";
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
$pak .= "'" . addslashes($row['emotion']) . "', ";
|
|
||||||
$pak .= "'" . addslashes($row['code']) . "', ";
|
|
||||||
}
|
|
||||||
$pak .= "\n";
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if ($pak != '')
|
|
||||||
{
|
|
||||||
$db->sql_close();
|
|
||||||
|
|
||||||
header('Content-Type: text/x-delimtext; name="' . $fields . '.pak"');
|
|
||||||
header('Content-disposition: attachment; filename=' . $fields . '.pak"');
|
|
||||||
echo $pak;
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_' . $fields . '_EXPORT']);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'delete':
|
|
||||||
|
|
||||||
$db->sql_query("DELETE FROM $table
|
|
||||||
WHERE {$fields}_id = $id");
|
|
||||||
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'smilies':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'icons':
|
|
||||||
// Reset appropriate icon_ids
|
|
||||||
$db->sql_query('UPDATE ' . TOPICS_TABLE . "
|
|
||||||
SET icon_id = 0
|
|
||||||
WHERE icon_id = $id");
|
|
||||||
$db->sql_query('UPDATE ' . POSTS_TABLE . "
|
|
||||||
SET icon_id = 0
|
|
||||||
WHERE icon_id = $id");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$notice = $user->lang[$lang . '_DELETED'];
|
|
||||||
|
|
||||||
case 'move_up':
|
|
||||||
case 'move_down':
|
|
||||||
|
|
||||||
if ($action != 'delete')
|
|
||||||
{
|
|
||||||
$image_order = intval($_GET['order']);
|
|
||||||
$order_total = $image_order * 2 + (($action == 'move_up') ? -1 : 1);
|
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $table . '
|
|
||||||
SET ' . $fields . "_order = $order_total - " . $fields . '_order
|
|
||||||
WHERE ' . $fields . "_order IN ($image_order, " . (($action == 'move_up') ? $image_order - 1 : $image_order + 1) . ')';
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$cache->destroy('icons');
|
|
||||||
|
|
||||||
}
|
|
||||||
// No break; here, display the smilies admin back
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
// By default, check that image_order is valid and fix it if necessary
|
|
||||||
$sql = "SELECT {$fields}_id AS order_id, {$fields}_order AS fields_order
|
|
||||||
FROM $table
|
|
||||||
ORDER BY {$fields}_order";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$order = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
++$order;
|
|
||||||
if ($row['fields_order'] != $order)
|
|
||||||
{
|
|
||||||
$db->sql_query("UPDATE $table
|
|
||||||
SET {$fields}_order = $order
|
|
||||||
WHERE {$fields}_id = " . $row['order_id']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ($row = $db->sql_fetchrow($result));
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// Output the page
|
|
||||||
adm_page_header($user->lang[$lang]);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang[$lang]; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if ($notice != '')
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<b style="color:green"><?php echo $notice; ?></b>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode ?>">
|
|
||||||
<table cellspacing="1" cellpadding="0" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<td align="right"> <a href="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=import'; ?>"><?php echo $user->lang['IMPORT_' . $lang]; ?></a> | <a href="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=export'; ?>"><?php echo $user->lang['EXPORT_' . $lang]; ?></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $user->lang[$lang]; ?></th>
|
|
||||||
<?php
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<th><?php echo $user->lang['CODE']; ?></th>
|
|
||||||
<th><?php echo $user->lang['EMOTION']; ?></th>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<th><?php echo $user->lang['ACTION']; ?></th>
|
|
||||||
<th><?php echo $user->lang['REORDER']; ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
$spacer = FALSE;
|
|
||||||
|
|
||||||
$sql = "SELECT *
|
|
||||||
FROM $table
|
|
||||||
ORDER BY display_on_posting DESC, {$fields}_order ASC";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
if (!$spacer && !$row['display_on_posting'])
|
|
||||||
{
|
|
||||||
$spacer = TRUE;
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="<?php echo ($mode == 'smilies') ? 5 : 3; ?>" align="center"><?php echo $user->lang[$lang . '_NOT_DISPLAYED'] ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
$row_class = ($row_class != 'row1') ? 'row1' : 'row2';
|
|
||||||
$alt_text = ($mode == 'smilies') ? htmlspecialchars($row['code']) : '';
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center"><img src="<?php echo $phpbb_root_path . $img_path . '/' . $row[$fields . '_url']; ?>" width="<?php echo $row[$fields . '_width']; ?>" height="<?php echo $row[$fields . '_height']; ?>" alt="<?php echo $alt_text; ?>" title="<?php echo $alt_text; ?>" /></td>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if ($mode == 'smilies')
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center"><?php echo htmlspecialchars($row['code']); ?></td>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['emotion']; ?></td>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=edit&id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=delete&id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['DELETE']; ?></a></td>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=move_up&order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_UP']; ?></a> <br /> <a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=move_down&order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_DOWN']; ?></a></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="<?php echo ($mode == 'smilies') ? 5 : 3; ?>" align="center"><input type="submit" name="add" value="<?php echo $user->lang['ADD_' . $lang]; ?>" class="btnmain" /> <input type="submit" name="edit" value="<?php echo $user->lang['EDIT_' . $lang]; ?>" class="btnmain" /></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,212 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
* @todo Check/enter/update transport info
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
if (!$auth->acl_get('a_server'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$module['GENERAL']['IM'] = basename(__FILE__) . $SID;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Include files
|
|
||||||
$phpbb_root_path = '../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
include($phpbb_root_path . 'includes/functions_jabber.'.$phpEx);
|
|
||||||
|
|
||||||
// Do we have general permissions?
|
|
||||||
if (!$auth->acl_get('a_server'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Grab some basic parameters
|
|
||||||
$submit = (isset($_POST['submit'])) ? true : false;
|
|
||||||
|
|
||||||
$jab_enable = request_var('jab_enable', $config['jab_enable']);
|
|
||||||
$jab_host = request_var('jab_host', $config['jab_host']);
|
|
||||||
$jab_port = request_var('jab_port', $config['jab_port']);
|
|
||||||
$jab_username = request_var('jab_username', $config['jab_username']);
|
|
||||||
$jab_password = request_var('jab_password', $config['jab_password']);
|
|
||||||
$jab_resource = request_var('jab_resource', $config['jab_resource']);
|
|
||||||
|
|
||||||
$jabber = new jabber();
|
|
||||||
$error = array();
|
|
||||||
|
|
||||||
// Setup the basis vars for jabber connection
|
|
||||||
$jabber->server = $jab_host;
|
|
||||||
$jabber->port = ($jab_port) ? $jab_port : 5222;
|
|
||||||
$jabber->username = $jab_username;
|
|
||||||
$jabber->password = $jab_password;
|
|
||||||
$jabber->resource = $jab_resource;
|
|
||||||
|
|
||||||
// Are changing (or initialising) a new host or username? If so run some checks and
|
|
||||||
// try to create account if it doesn't exist
|
|
||||||
if ($jab_enable)
|
|
||||||
{
|
|
||||||
if ($jab_host != $config['jab_host'] || $jab_username != $config['jab_username'])
|
|
||||||
{
|
|
||||||
if (!$jabber->Connect())
|
|
||||||
{
|
|
||||||
trigger_error('Could not connect to Jabber server', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// First we'll try to authorise using this account, if that fails we'll
|
|
||||||
// try to create it.
|
|
||||||
if (!($result = $jabber->SendAuth()))
|
|
||||||
{
|
|
||||||
if (($result = $jabber->AccountRegistration($config['board_email'], $config['sitename'])) <> 2)
|
|
||||||
{
|
|
||||||
|
|
||||||
$error[] = ($result == 1) ? $user->lang['ERR_JAB_USERNAME'] : sprintf($user->lang['ERR_JAB_REGISTER'], $result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = $user->lang['JAB_REGISTERED'];
|
|
||||||
$log = 'JAB_REGISTER';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = $user->lang['JAB_CHANGED'];
|
|
||||||
$log = 'JAB_CHANGED';
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep(1);
|
|
||||||
$jabber->Disconnect();
|
|
||||||
}
|
|
||||||
else if ($jab_password != $config['jab_password'])
|
|
||||||
{
|
|
||||||
if (!$jabber->Connect())
|
|
||||||
{
|
|
||||||
trigger_error('Could not connect to Jabber server', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$jabber->SendAuth())
|
|
||||||
{
|
|
||||||
trigger_error('Could not authorise on Jabber server', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
$jabber->SendPresence(NULL, NULL, 'online');
|
|
||||||
|
|
||||||
if (($result = $jabber->ChangePassword($jab_password)) <> 2)
|
|
||||||
{
|
|
||||||
$error[] = ($result == 1) ? $user->lang['ERR_JAB_PASSCHG'] : sprintf($user->lang['ERR_JAB_PASSFAIL'], $result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = $user->lang['JAB_PASS_CHANGED'];
|
|
||||||
$log = 'JAB_PASSCHG';
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep(1);
|
|
||||||
$jabber->Disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pull relevant config data
|
|
||||||
$sql = 'SELECT *
|
|
||||||
FROM ' . CONFIG_TABLE . "
|
|
||||||
WHERE config_name LIKE 'jab_%'";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$config_name = $row['config_name'];
|
|
||||||
$config_value = $row['config_value'];
|
|
||||||
|
|
||||||
$default_config[$config_name] = $config_value;
|
|
||||||
$new[$config_name] = (isset($_POST[$config_name])) ? request_var($config_name, '') : $default_config[$config_name];
|
|
||||||
|
|
||||||
if ($submit && !sizeof($error))
|
|
||||||
{
|
|
||||||
set_config($config_name, $new[$config_name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($submit && !sizeof($error))
|
|
||||||
{
|
|
||||||
add_log('admin', 'LOG_' . $log);
|
|
||||||
trigger_error($message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Output the page
|
|
||||||
adm_page_header($user->lang['IM']);
|
|
||||||
|
|
||||||
$jab_enable_yes = ($new['jab_enable']) ? 'checked="checked"' : '';
|
|
||||||
$jab_enable_no = (!$new['jab_enable']) ? 'checked="checked"' : '';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<h1><?php echo $user->lang['IM']; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['IM_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="<?php echo "admin_jabber.$phpEx$SID"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang['IM']; ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if (sizeof($error))
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="2" align="center"><span style="color:red"><?php echo implode('<br />', $error); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b><?php echo $user->lang['JAB_ENABLE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_ENABLE_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><input type="radio" name="jab_enable" value="1"<?php echo $jab_enable_yes; ?> /><?php echo $user->lang['ENABLED']; ?> <input type="radio" name="jab_enable" value="0"<?php echo $jab_enable_no; ?> /><?php echo $user->lang['DISABLED']; ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b><?php echo $user->lang['JAB_SERVER']; ?>: </b><br /><span class="gensmall"><?php echo sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/user/publicservers.php" target="_blank">', '</a>'); ?></span></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="jab_host" value="<?php echo $new['jab_host']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="40%"><b><?php echo $user->lang['JAB_PORT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_PORT_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="jab_port" value="<?php echo $new['jab_port']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['JAB_USERNAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_USERNAME_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="jab_username" value="<?php echo $new['jab_username']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['JAB_PASSWORD']; ?>: </b></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="jab_password" value="<?php echo $new['jab_password']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['JAB_RESOURCE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_RESOURCE_EXPLAIN']; ?></span></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="jab_resource" value="<?php echo $new['jab_resource']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
?>
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,85 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
$module['GENERAL']['PHP_INFO'] = ($auth->acl_get('a_server')) ? basename(__FILE__) . $SID : '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Load default header
|
|
||||||
$phpbb_root_path = '../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
|
|
||||||
// Check permissions
|
|
||||||
if (!$auth->acl_get('a_server'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES);
|
|
||||||
$phpinfo = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
// Get used layout
|
|
||||||
$layout = (preg_match('#bgcolor#i', $phpinfo)) ? 'old' : 'new';
|
|
||||||
|
|
||||||
// Here we play around a little with the PHP Info HTML to try and stylise
|
|
||||||
// it along phpBB's lines ... hopefully without breaking anything. The idea
|
|
||||||
// for this was nabbed from the PHP annotated manual
|
|
||||||
preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpinfo, $output);
|
|
||||||
|
|
||||||
switch ($layout)
|
|
||||||
{
|
|
||||||
case 'old':
|
|
||||||
$output = preg_replace('#<table#', '<table class="bg"', $output[1][0]);
|
|
||||||
$output = preg_replace('# bgcolor="\#(\w){6}"#', '', $output);
|
|
||||||
$output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
|
|
||||||
$output = preg_replace('#border="0" cellpadding="3" cellspacing="1" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output);
|
|
||||||
$output = preg_replace('#<tr valign="top"><td align="left">(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td style="{background-color: #9999cc;}"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td style="{background-color: #9999cc;}">\2</td><td style="{background-color: #9999cc;}">\1</td></tr></table></td></tr>', $output);
|
|
||||||
$output = preg_replace('#<tr valign="baseline"><td[ ]{0,1}><b>(.*?)</b>#', '<tr><td class="row1" nowrap="nowrap">\1', $output);
|
|
||||||
$output = preg_replace('#<td align="(center|left)">#', '<td class="row2">', $output);
|
|
||||||
$output = preg_replace('#<td>#', '<td class="row2">', $output);
|
|
||||||
$output = preg_replace('#valign="middle"#', '', $output);
|
|
||||||
$output = preg_replace('#<tr >#', '<tr>', $output);
|
|
||||||
$output = preg_replace('#<hr(.*?)>#', '', $output);
|
|
||||||
$output = preg_replace('#<h1 align="center">#i', '<h1>', $output);
|
|
||||||
$output = preg_replace('#<h2 align="center">#i', '<h2>', $output);
|
|
||||||
break;
|
|
||||||
case 'new':
|
|
||||||
$output = preg_replace('#<table#', '<table class="bg" align="center"', $output[1][0]);
|
|
||||||
$output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
|
|
||||||
$output = preg_replace('#border="0" cellpadding="3" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output);
|
|
||||||
$output = preg_replace('#<tr class="v"><td>(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td>\2</td><td>\1</td></tr></table></td></tr>', $output);
|
|
||||||
$output = preg_replace('#<td>#', '<td style="{background-color: #9999cc;}">', $output);
|
|
||||||
$output = preg_replace('#class="e"#', 'class="row1" nowrap="nowrap"', $output);
|
|
||||||
$output = preg_replace('#class="v"#', 'class="row2"', $output);
|
|
||||||
$output = preg_replace('# class="h"#', '', $output);
|
|
||||||
$output = preg_replace('#<hr />#', '', $output);
|
|
||||||
preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output);
|
|
||||||
$output = $output[1][0];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
adm_page_header($user->lang['PHP_INFO']);
|
|
||||||
|
|
||||||
echo '<h1>' . $user->lang['PHP_INFO'] . '</h1>';
|
|
||||||
echo '<p>' . $user->lang['PHP_INFO_EXPLAIN'] . '</p>';
|
|
||||||
echo $output;
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,253 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
if (!$auth->acl_get('a_'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$filename = basename(__FILE__);
|
|
||||||
$module['LOG']['ADMIN_LOGS'] = $filename . "$SID&mode=admin";
|
|
||||||
$module['LOG']['MOD_LOGS'] = $filename . "$SID&mode=mod";
|
|
||||||
$module['LOG']['CRITICAL_LOGS'] = $filename . "$SID&mode=critical";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Include files
|
|
||||||
$phpbb_root_path = '../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
// Do we have styles admin permissions?
|
|
||||||
if (!$auth->acl_get('a_'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set some variables
|
|
||||||
$mode = request_var('mode', 'admin');
|
|
||||||
$forum_id = request_var('f', 0);
|
|
||||||
$start = request_var('start', 0);
|
|
||||||
$deletemark = (isset($_POST['delmarked'])) ? true : false;
|
|
||||||
$deleteall = (isset($_POST['delall'])) ? true : false;
|
|
||||||
$marked = request_var('mark', array(0));
|
|
||||||
|
|
||||||
// Sort keys
|
|
||||||
$sort_days = request_var('st', 0);
|
|
||||||
$sort_key = request_var('sk', 't');
|
|
||||||
$sort_dir = request_var('sd', 'd');
|
|
||||||
|
|
||||||
// Define some vars depending on which logs we're looking at
|
|
||||||
$log_type = ($mode == 'admin') ? LOG_ADMIN : (($mode == 'mod') ? LOG_MOD : LOG_CRITICAL);
|
|
||||||
|
|
||||||
$user->add_lang('mcp');
|
|
||||||
|
|
||||||
// Delete entries if requested and able
|
|
||||||
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
|
|
||||||
{
|
|
||||||
$where_sql = '';
|
|
||||||
if ($deletemark && $marked)
|
|
||||||
{
|
|
||||||
$sql_in = array();
|
|
||||||
foreach ($marked as $mark)
|
|
||||||
{
|
|
||||||
$sql_in[] = $mark;
|
|
||||||
}
|
|
||||||
$where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')';
|
|
||||||
unset($sql_in);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . LOG_TABLE . "
|
|
||||||
WHERE log_type = $log_type
|
|
||||||
$where_sql";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
add_log('admin', 'LOG_' . strtoupper($mode) . '_CLEAR');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sorting
|
|
||||||
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
|
||||||
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
|
|
||||||
$sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
|
|
||||||
|
|
||||||
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
|
||||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
|
|
||||||
|
|
||||||
// Define where and sort sql for use in displaying logs
|
|
||||||
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
|
|
||||||
$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
|
||||||
|
|
||||||
$l_title = $user->lang[strtoupper($mode) . '_LOGS'];
|
|
||||||
$l_title_explain = $user->lang[strtoupper($mode) . '_LOGS_EXPLAIN'];
|
|
||||||
|
|
||||||
// Output page
|
|
||||||
adm_page_header($l_title);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $l_title; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $l_title_explain; ?></p>
|
|
||||||
|
|
||||||
<form name="list" method="post" action="<?php echo "admin_viewlogs.$phpEx$SID&mode=$mode"; ?>">
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Define forum list if we're looking @ mod logs
|
|
||||||
if ($mode == 'mod')
|
|
||||||
{
|
|
||||||
|
|
||||||
$forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<table width="100%" cellpadding="1" cellspacing="1" border="0">
|
|
||||||
<tr>
|
|
||||||
<td align="right"><?php echo $user->lang['SELECT_FORUM']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Grab log data
|
|
||||||
//
|
|
||||||
$log_data = array();
|
|
||||||
$log_count = 0;
|
|
||||||
view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<td align="left" valign="top"> <span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td>
|
|
||||||
<td align="right" valign="top" nowrap="nowrap">
|
|
||||||
<span class="nav"><?php echo generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&$u_sort_param", $log_count, $config['topics_per_page'], $start, true); ?></span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="5" height="28" align="center"><?php echo $user->lang['DISPLAY_LOG']; ?>: <?php echo $s_limit_days; ?> <?php echo $user->lang['SORT_BY']; ?>: <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th>
|
|
||||||
<th width="15%" nowrap="nowrap"><?php echo $user->lang['IP']; ?></th>
|
|
||||||
<th width="20%" nowrap="nowrap"><?php echo $user->lang['TIME']; ?></th>
|
|
||||||
<th width="45%" nowrap="nowrap"><?php echo $user->lang['ACTION']; ?></th>
|
|
||||||
<th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$row_class = '';
|
|
||||||
|
|
||||||
if ($log_count)
|
|
||||||
{
|
|
||||||
for ($i = 0; $i < sizeof($log_data); $i++)
|
|
||||||
{
|
|
||||||
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $log_data[$i]['ip']; ?></td>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $user->format_date($log_data[$i]['time']); ?></td>
|
|
||||||
<td class="<?php echo $row_class; ?>"><?php
|
|
||||||
echo $log_data[$i]['action'];
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
|
|
||||||
foreach (array('viewtopic', 'viewlogs', 'viewforum') as $check)
|
|
||||||
{
|
|
||||||
if (isset($log_data[$i][$check]) && $log_data[$i][$check])
|
|
||||||
{
|
|
||||||
$data[] = '<a href="' . $log_data[$i][$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof($data))
|
|
||||||
{
|
|
||||||
echo '<br />» <span class="gensmall">[ ' . implode(' | ', $data) . ' ]</span>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($auth->acl_get('a_clearlogs'))
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="5" height="28" align="right"><input class="btnlite" type="submit" name="delmarked" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> <input class="btnlite" type="submit" name="delall" value="<?php echo $user->lang['DELETE_ALL']; ?>" /> </td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" colspan="5" align="center" nowrap="nowrap"><?php echo $user->lang['NO_ENTRIES']; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<td align="left" valign="top"> <span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td>
|
|
||||||
<td align="right" valign="top" nowrap="nowrap"><span class="nav"><?php
|
|
||||||
|
|
||||||
if ($auth->acl_get('a_clearlogs'))
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
?><b><a href="javascript:marklist('list', true);"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('list', false);"><?php echo $user->lang['UNMARK_ALL']; ?></a></b> <br /><br /><?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
echo generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&$u_sort_param", $log_count, $config['topics_per_page'], $start, true);
|
|
||||||
|
|
||||||
?></span></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<script language="Javascript" type="text/javascript">
|
|
||||||
<!--
|
|
||||||
function marklist(match, status)
|
|
||||||
{
|
|
||||||
len = eval('document.' + match + '.length');
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
eval('document.' + match + '.elements[i].checked = ' + status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//-->
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,200 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package acp
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
if (!empty($setmodules))
|
|
||||||
{
|
|
||||||
if (!$auth->acl_get('a_words'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$module['POST']['WORD_CENSOR'] = basename(__FILE__) . $SID;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
|
||||||
// Include files
|
|
||||||
$phpbb_root_path = './../';
|
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
||||||
require('pagestart.' . $phpEx);
|
|
||||||
|
|
||||||
// Do we have forum admin permissions?
|
|
||||||
if (!$auth->acl_get('a_words'))
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_ADMIN']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$mode = request_var('mode', '');
|
|
||||||
$mode = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $mode);
|
|
||||||
|
|
||||||
$s_hidden_fields = '';
|
|
||||||
$word_info = array();
|
|
||||||
|
|
||||||
switch ($mode)
|
|
||||||
{
|
|
||||||
case 'edit':
|
|
||||||
$word_id = request_var('id', 0);
|
|
||||||
|
|
||||||
if (!$word_id)
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_WORD']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT *
|
|
||||||
FROM ' . WORDS_TABLE . "
|
|
||||||
WHERE word_id = $word_id";
|
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
|
||||||
|
|
||||||
$word_info = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />';
|
|
||||||
|
|
||||||
case 'add':
|
|
||||||
|
|
||||||
adm_page_header($user->lang['WORDS_TITLE']);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="<?php echo "admin_words.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><?php echo $user->lang['EDIT_WORD']; ?></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['WORD']; ?>: </b></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="word" value="<?php echo $word_info['word']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1"><b><?php echo $user->lang['REPLACEMENT']; ?>: </b></td>
|
|
||||||
<td class="row2"><input class="post" type="text" name="replacement" value="<?php echo $word_info['replacement']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input class="btnmain" type="submit" name="save" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'save':
|
|
||||||
$word_id = request_var('id', 0);
|
|
||||||
$word = request_var('word', '');
|
|
||||||
$replacement = request_var('replacement', '');
|
|
||||||
|
|
||||||
if (!$word || !$replacement)
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['ENTER_WORD']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . $db->sql_escape($word) . "', replacement = '" . $db->sql_escape($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . $db->sql_escape($word) . "', '" . $db->sql_escape($replacement) . "')";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$cache->destroy('word_censors');
|
|
||||||
|
|
||||||
$log_action = ($word_id) ? 'LOG_EDIT_WORD' : 'LOG_ADD_WORD';
|
|
||||||
add_log('admin', $log_action, $word);
|
|
||||||
|
|
||||||
$message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED'];
|
|
||||||
trigger_error($message);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'delete':
|
|
||||||
|
|
||||||
$word_id = request_var('id', 0);
|
|
||||||
|
|
||||||
if (!$word_id)
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_WORD']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT word
|
|
||||||
FROM ' . WORDS_TABLE . "
|
|
||||||
WHERE word_id = $word_id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$deleted_word = $db->sql_fetchfield('word', 0, $result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . WORDS_TABLE . "
|
|
||||||
WHERE word_id = $word_id";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$cache->destroy('word_censors');
|
|
||||||
|
|
||||||
add_log('admin', 'LOG_DELETE_WORD', $deleted_word);
|
|
||||||
|
|
||||||
$message = $user->lang['WORD_REMOVE'];
|
|
||||||
trigger_error($message);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
adm_page_header($user->lang['WORDS_TITLE']);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1>
|
|
||||||
|
|
||||||
<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p>
|
|
||||||
|
|
||||||
<form method="post" action="admin_words.<?php echo $phpEx . $SID; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<th><?php echo $user->lang['WORD']; ?></th>
|
|
||||||
<th><?php echo $user->lang['REPLACEMENT']; ?></th>
|
|
||||||
<th colspan="2"><?php echo $user->lang['ACTION']; ?></th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql = 'SELECT *
|
|
||||||
FROM ' . WORDS_TABLE . '
|
|
||||||
ORDER BY word';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$row_class = '';
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
$row_class = ($row_class == 'row1') ? 'row2' : 'row1';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['word']; ?></td>
|
|
||||||
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['replacement']; ?></td>
|
|
||||||
<td class="<?php echo $row_class; ?>"> <a href="<?php echo "admin_words.$phpEx$SID&mode=edit&id=" . $row['word_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> </td>
|
|
||||||
<td class="<?php echo $row_class; ?>"> <a href="<?php echo "admin_words.$phpEx$SID&mode=delete&id=" . $row['word_id']; ?>"><?php echo $user->lang['DELETE']; ?></a> </td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
while ($row = $db->sql_fetchrow($result));
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="5" height="28" align="center"><?php echo $s_hidden_fields; ?><input class="btnmain" type="submit" name="add" value="<?php echo $user->lang['ADD_WORD']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
adm_page_footer();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
Loading…
Add table
Reference in a new issue