mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
- some cross-db related changes
- putting active bots array into cache git-svn-id: file:///svn/phpbb/trunk@5140 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -62,7 +62,6 @@ switch ($mode)
|
||||
|
||||
if ($mode == 'attach')
|
||||
{
|
||||
|
||||
$config_sizes = array('max_filesize' => 'size', 'attachment_quota' => 'quota_size', 'max_filesize_pm' => 'pm_size');
|
||||
foreach ($config_sizes as $cfg_key => $var)
|
||||
{
|
||||
@@ -271,7 +270,7 @@ if ($submit && $mode == 'ext_groups')
|
||||
{
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . "
|
||||
WHERE LOWER(group_name) = '" . strtolower($new_group_name) . "'";
|
||||
WHERE LOWER(group_name) = '" . $db->sql_escape(strtolower($new_group_name)) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
if ($db->sql_fetchrow($result))
|
||||
{
|
||||
@@ -286,8 +285,8 @@ if ($submit && $mode == 'ext_groups')
|
||||
$upload_icon = request_var('upload_icon', 'no_image');
|
||||
$size_select = request_var('size_select', 'b');
|
||||
$forum_select = request_var('forum_select', false);
|
||||
$allowed_forums = isset($_REQUEST['allowed_forums']) ? array_map('intval', array_values($_REQUEST['allowed_forums'])) : array();
|
||||
$allow_in_pm = isset($_REQUEST['allow_in_pm']) ? true : false;
|
||||
$allowed_forums = isset($_POST['allowed_forums']) ? array_map('intval', array_values($_POST['allowed_forums'])) : array();
|
||||
$allow_in_pm = isset($_POST['allow_in_pm']) ? true : false;
|
||||
$max_filesize = request_var('max_filesize', 0);
|
||||
$max_filesize = ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize);
|
||||
|
||||
@@ -304,7 +303,7 @@ if ($submit && $mode == 'ext_groups')
|
||||
$group_ary = array(
|
||||
'group_name' => $group_name,
|
||||
'cat_id' => request_var('special_category', ATTACHMENT_CATEGORY_NONE),
|
||||
'allow_group' => (isset($_REQUEST['allow_group'])) ? 1 : 0,
|
||||
'allow_group' => (isset($_POST['allow_group'])) ? 1 : 0,
|
||||
'download_mode' => request_var('download_mode', INLINE_LINK),
|
||||
'upload_icon' => ($upload_icon == 'no_image') ? '' : $upload_icon,
|
||||
'max_filesize' => $max_filesize,
|
||||
@@ -362,8 +361,8 @@ if ($submit && $mode == 'ext_groups')
|
||||
|
||||
if ($submit && $mode == 'orphan')
|
||||
{
|
||||
$delete_files = (isset($_REQUEST['delete'])) ? array_keys(request_var('delete', '')) : array();
|
||||
$add_files = (isset($_REQUEST['add'])) ? array_keys(request_var('add', '')) : array();
|
||||
$delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', '')) : array();
|
||||
$add_files = (isset($_POST['add'])) ? array_keys(request_var('add', '')) : array();
|
||||
$post_ids = request_var('post_id', 0);
|
||||
|
||||
foreach ($delete_files as $delete)
|
||||
@@ -722,10 +721,10 @@ if ($mode == 'ext_groups')
|
||||
|
||||
$action = request_var('action', 'show');
|
||||
$group_id = request_var('g', 0);
|
||||
$action = (isset($_REQUEST['add'])) ? 'add' : $action;
|
||||
$action = (isset($_POST['add'])) ? 'add' : $action;
|
||||
$action = (($action == 'add' || $action == 'edit') && $submit && !sizeof($error)) ? 'show' : $action;
|
||||
|
||||
if (isset($_REQUEST['select_mode']))
|
||||
if (isset($_POST['select_mode']))
|
||||
{
|
||||
$action = 'show';
|
||||
}
|
||||
@@ -746,7 +745,8 @@ if ($mode == 'ext_groups')
|
||||
WHERE group_id = $group_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$group_name = $db->sql_fetchfield('group_name', 0, $result);
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'DELETE
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . "
|
||||
WHERE group_id = $group_id";
|
||||
@@ -1131,7 +1131,7 @@ if ($mode == 'extensions')
|
||||
<th> <?php echo $user->lang['ADD_EXTENSION']; ?> </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension" class="post" value="<?php echo $add_extension; ?>" /></td>
|
||||
<td class="row1" align="center" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension" class="post" value="<?php echo (isset($add_extension)) ? $add_extension : ''; ?>" /></td>
|
||||
<td class="row2" align="center" valign="middle"><?php echo (($submit) ? group_select('add_group_select', $add_extension_group) : group_select('add_group_select')) ?></td>
|
||||
<td class="row1" align="center" valign="middle"><input type="checkbox" name="add_extension_check" /></td>
|
||||
</tr>
|
||||
@@ -1279,7 +1279,7 @@ function marklist(match, name, status)
|
||||
adm_page_footer();
|
||||
|
||||
// Build Select for category items
|
||||
function category_select($select_name, $group_id = FALSE)
|
||||
function category_select($select_name, $group_id = false)
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
@@ -1294,7 +1294,7 @@ function category_select($select_name, $group_id = FALSE)
|
||||
{
|
||||
$sql = 'SELECT cat_id
|
||||
FROM ' . EXTENSION_GROUPS_TABLE . '
|
||||
WHERE group_id = ' . intval($group_id);
|
||||
WHERE group_id = ' . (int) $group_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$cat_type = (!($row = $db->sql_fetchrow($result))) ? ATTACHMENT_CATEGORY_NONE : $row['cat_id'];
|
||||
@@ -1320,7 +1320,7 @@ function category_select($select_name, $group_id = FALSE)
|
||||
}
|
||||
|
||||
// Extension group select
|
||||
function group_select($select_name, $default_group = '-1')
|
||||
function group_select($select_name, $default_group = false)
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
@@ -1342,9 +1342,9 @@ function group_select($select_name, $default_group = '-1')
|
||||
$row['group_name'] = $user->lang['NOT_ASSIGNED'];
|
||||
$group_name[] = $row;
|
||||
|
||||
for ($i = 0; $i < count($group_name); $i++)
|
||||
for ($i = 0; $i < sizeof($group_name); $i++)
|
||||
{
|
||||
if ($default_group == '-1')
|
||||
if ($default_group === false)
|
||||
{
|
||||
$selected = ($i == 0) ? ' selected="selected"' : '';
|
||||
}
|
||||
@@ -1375,7 +1375,7 @@ function download_select($select_name, $group_id = false)
|
||||
{
|
||||
$sql = "SELECT download_mode
|
||||
FROM " . EXTENSION_GROUPS_TABLE . "
|
||||
WHERE group_id = " . intval($group_id);
|
||||
WHERE group_id = " . (int) $group_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$download_mode = (!($row = $db->sql_fetchrow($result))) ? INLINE_LINK : $row['download_mode'];
|
||||
@@ -1400,7 +1400,7 @@ function download_select($select_name, $group_id = false)
|
||||
return $group_select;
|
||||
}
|
||||
|
||||
/* Upload already uploaded file... huh? are you kidding?
|
||||
// Upload already uploaded file... huh? are you kidding?
|
||||
function upload_file($post_id, $topic_id, $forum_id, $upload_dir, $filename)
|
||||
{
|
||||
global $message_parser, $db, $user, $phpbb_root_path;
|
||||
@@ -1410,7 +1410,7 @@ function upload_file($post_id, $topic_id, $forum_id, $upload_dir, $filename)
|
||||
$message_parser->filename_data['filecomment'] = '';
|
||||
$message_parser->filename_data['filename'] = $phpbb_root_path . $upload_dir . '/' . basename($filename);
|
||||
|
||||
$filedata = upload_attachment($forum_id, $filename, true, $phpbb_root_path . $upload_dir . '/' . basename($filename));
|
||||
$filedata = upload_attachment('local', $forum_id, true, $phpbb_root_path . $upload_dir . '/' . basename($filename));
|
||||
|
||||
if ($filedata['post_attach'] && !sizeof($filedata['error']))
|
||||
{
|
||||
@@ -1460,7 +1460,6 @@ function upload_file($post_id, $topic_id, $forum_id, $upload_dir, $filename)
|
||||
echo '<span style="color:red">' . sprintf($user->lang['ADMIN_UPLOAD_ERROR'], implode("<br />\t", $filedata['error'])) . '</span><br /><br />';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Search Imagick
|
||||
function search_imagemagick()
|
||||
|
@@ -31,19 +31,19 @@ require('pagestart.' . $phpEx);
|
||||
// Do we have general permissions?
|
||||
if (!$auth->acl_get('a_bbcode'))
|
||||
{
|
||||
trigger_error($user->lang['NO_ADMIN']);
|
||||
trigger_error('NO_ADMIN');
|
||||
}
|
||||
|
||||
// Set up general vars
|
||||
$mode = (!empty($_REQUEST['mode'])) ? $_REQUEST['mode'] : '';
|
||||
$bbcode_id = (!empty($_REQUEST['bbcode'])) ? intval($_REQUEST['bbcode']) : 0;
|
||||
$mode = request_var('mode', '');
|
||||
$bbcode_id = request_var('bbcode', 0);
|
||||
|
||||
// Set up mode-specific vars
|
||||
switch ($mode)
|
||||
{
|
||||
case 'add':
|
||||
$bbcode_match = $bbcode_tpl = '';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$sql = 'SELECT bbcode_match, bbcode_tpl
|
||||
@@ -54,10 +54,11 @@ switch ($mode)
|
||||
{
|
||||
trigger_error('BBCODE_NOT_EXIST');
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$bbcode_match = $row['bbcode_match'];
|
||||
$bbcode_tpl = htmlspecialchars($row['bbcode_tpl']);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'modify':
|
||||
$sql = 'SELECT bbcode_id
|
||||
@@ -68,13 +69,14 @@ switch ($mode)
|
||||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
// Do major work
|
||||
@@ -164,7 +166,7 @@ switch ($mode)
|
||||
<?php
|
||||
|
||||
adm_page_footer();
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'modify':
|
||||
case 'create':
|
||||
@@ -173,13 +175,13 @@ switch ($mode)
|
||||
$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']
|
||||
'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')
|
||||
@@ -193,10 +195,12 @@ switch ($mode)
|
||||
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);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
if ($row)
|
||||
{
|
||||
$bbcode_id = $row['bbcode_id'] + 1;
|
||||
$bbcode_id = $row['bbcode_id'] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,6 +208,7 @@ switch ($mode)
|
||||
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)
|
||||
{
|
||||
@@ -236,7 +241,7 @@ switch ($mode)
|
||||
add_log('admin', $log_action, $data['bbcode_tag']);
|
||||
|
||||
trigger_error($lang);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$sql = 'SELECT bbcode_tag
|
||||
@@ -249,6 +254,7 @@ switch ($mode)
|
||||
$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
|
||||
|
||||
@@ -287,6 +293,7 @@ switch ($mode)
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
?>
|
||||
|
||||
@@ -414,13 +421,14 @@ function build_regexp($msg_bbcode, $msg_html)
|
||||
$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
|
||||
'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
|
||||
// -----------------------------
|
||||
|
||||
?>
|
@@ -59,6 +59,8 @@ switch ($action)
|
||||
WHERE bot_id $id";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$cache->destroy('bots');
|
||||
break;
|
||||
|
||||
case 'deactivate':
|
||||
@@ -70,6 +72,8 @@ switch ($action)
|
||||
WHERE bot_id $id";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$cache->destroy('bots');
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
@@ -105,6 +109,8 @@ switch ($action)
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
$cache->destroy('bots');
|
||||
|
||||
add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary));
|
||||
trigger_error($user->lang['BOT_DELETED']);
|
||||
}
|
||||
@@ -125,6 +131,7 @@ switch ($action)
|
||||
{
|
||||
$error[] = $user->lang['ERR_BOT_NO_MATCHES'];
|
||||
}
|
||||
|
||||
if ($bot_ip && !preg_match('#^[\d\.,:]+$#', $bot_ip))
|
||||
{
|
||||
if (!$ip_list = gethostbynamel($bot_ip))
|
||||
@@ -218,6 +225,8 @@ switch ($action)
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
$cache->destroy('bots');
|
||||
|
||||
add_log('admin', 'LOG_BOT_' . $log, $bot_name);
|
||||
trigger_error($user->lang['BOT_' . $log]);
|
||||
}
|
||||
@@ -345,6 +354,7 @@ $sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit
|
||||
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';
|
||||
|
@@ -3051,7 +3051,7 @@ function install($type, $action, $id)
|
||||
<tr>
|
||||
<td class="row1" width="40%"><b><?php echo $user->lang[$l_type . '_NAME']; ?>:</b></td>
|
||||
<td class="row2"><?php
|
||||
$style_name = 'proSilver';
|
||||
$style_name = 'subSilver2';
|
||||
$style_copyright = '(c) 2004 Tom Beddard';
|
||||
echo ($action == 'add') ? '<input class="post" type="text" name="name" maxlength="30" size="30" value="' . $name . '" />' : '<b>' . ${$type . '_name'} . '</b>';
|
||||
|
||||
|
Reference in New Issue
Block a user