1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 23:25:30 +02:00

Minor fixes

git-svn-id: file:///svn/phpbb/trunk@3316 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud 2003-01-13 05:11:11 +00:00
parent 9f4cb905d3
commit ab928d8f5f
4 changed files with 39 additions and 37 deletions

View File

@ -98,10 +98,7 @@ while ($row = $db->sql_fetchrow($result))
if (isset($_POST['submit']))
{
$sql = "UPDATE " . CONFIG_TABLE . " SET
config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
WHERE config_name = '$config_name'";
$db->sql_query($sql);
set_config($config_name, stripslashes($new[$config_name]));
}
}
@ -549,9 +546,7 @@ switch ($mode)
{
if (!isset($config[$field]))
{
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
VALUES ('$field', '')";
$db->sql_query($sql);
set_config($field, '');
}
}
}

View File

@ -72,7 +72,7 @@ switch ($mode)
$result = $db->sql_query('SELECT parent_id, left_id, right_id FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id");
if (!$row = $db->sql_fetchrow($result))
{
message_die(ERROR, 'Forum does not exist');
trigger_error('Forum does not exist');
}
extract($row);
$forum_info = array($forum_id => $row);
@ -192,8 +192,8 @@ switch ($mode)
'parent_id' => $parent_id,
'left_id' => $left_id,
'right_id' => $right_id,
'forum_status' => (!empty($_POST['is_category'])) ? ITEM_CATEGORY : intval($_POST['forum_status']),
'forum_postable' => (!empty($_POST['is_category'])) ? 0 : 1,
'forum_status' => ITEM_UNLOCKED,
'forum_postable' => (!empty($_POST['forum_postable'])) ? 1 : 0,
'forum_name' => sql_quote($_POST['forum_name']),
'forum_desc' => sql_quote($_POST['forum_desc']),
'forum_style' => (!empty($_POST['forum_style'])) ? intval($_POST['forum_style']) : 'NULL',
@ -210,14 +210,14 @@ switch ($mode)
$forum_id = $db->sql_nextid();
// Redirect to permissions
redirect('admin_permissions.' . $phpEx . $SID . '&mode=forums&f=' . $forum_id);
redirect('admin/admin_permissions.' . $phpEx . $SID . '&mode=forums&f=' . $forum_id);
break;
case 'modify':
if (!$forum_id = intval($_POST['f']))
{
message_die(ERROR, 'No forum specified');
trigger_error('No forum specified');
}
$row = get_forum_info($forum_id);
@ -271,7 +271,8 @@ switch ($mode)
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . " WHERE forum_id = $forum_id");
$message = $user->lang['Forums_updated'] . "<br /><br />" . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&parent_id=' . $parent_id . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_admin_index'], '<a href="index.' . $phpEx . $SID . '?pane=right' . '">', '</a>');
message_die(MESSAGE, $message);
trigger_error($message);
break;
@ -300,7 +301,7 @@ switch ($mode)
{
$message = $user->lang['No_destination_forum'] . '<br /><br />' . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&mode=delete&f=' . $forum_id. '">', '</a>');
message_die(ERROR, $message);
trigger_error($message);
}
move_forum_content($forum_id, $_POST['posts_to_id']);
@ -325,7 +326,7 @@ switch ($mode)
{
$message = $user->lang['No_destination_forum'] . '<br /><br />' . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&mode=delete&f=' . $forum_id. '">', '</a>');
message_die(ERROR, $message);
trigger_error($message);
}
$result = $db->sql_query('SELECT forum_id FROM ' . FORUMS_TABLE . " WHERE parent_id = $forum_id");
@ -360,7 +361,7 @@ switch ($mode)
$return_id = (!empty($_POST['subforums_to_id'])) ? $_POST['subforums_to_id'] : $parent_id;
$message = $user->lang['Forum_deleted'] . '<br /><br />' . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&parent_id=' . $return_id. '">', '</a>');
message_die(MESSAGE, $message);
trigger_error($message);
break;
case 'sync':
@ -745,7 +746,7 @@ while ($row = $db->sql_fetchrow($result))
<td class="row2" width="15%" align="center" valign="middle" nowrap="nowrap"><span class="gen"><a href="admin_forums.<?php echo $url ?>&amp;mode=move_up"><?php echo $user->lang['Move_up'] ?></a> <br /> <a href="admin_forums.<?php echo $url ?>&amp;mode=move_down"><?php echo $user->lang['Move_down'] ?></a></span></td>
<td class="row2" width="20%" align="center" valign="middle" nowrap="nowrap">&nbsp;<span class="gen"><a href="admin_forums.<?php echo $url ?>&amp;mode=edit"><?php echo $user->lang['Edit'] ?></a> | <a href="admin_forums.<?php echo $url ?>&amp;mode=delete"><?php echo $user->lang['Delete'] ?></a> | <a href="admin_forums.<?php echo $url ?>&amp;mode=sync"><?php echo $user->lang['Resync'] ?></a></span>&nbsp;</td>
<td class="row2" width="20%" align="center" valign="middle" nowrap="nowrap">&nbsp;<span class="gen"><a href="admin_forums.<?php echo $url ?>&amp;mode=edit"><?php echo $user->lang['Edit'] ?></a> | <a href="admin_forums.<?php echo $url ?>&amp;mode=delete"><?php echo $user->lang['DELETE'] ?></a> | <a href="admin_forums.<?php echo $url ?>&amp;mode=sync"><?php echo $user->lang['Resync'] ?></a></span>&nbsp;</td>
</tr>
<?php

View File

@ -102,10 +102,7 @@ if (isset($_POST['start']) || isset($_GET['batchstart']))
//
// Take board offline
//
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '1'
WHERE config_name = 'board_disable'";
$db->sql_query($sql);
set_config('board_disable', 1);
//
// Empty existing tables
@ -279,11 +276,7 @@ if (isset($_POST['start']) || isset($_GET['batchstart']))
}
else
{
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '0'
WHERE config_name = 'board_disable'";
$db->sql_query($sql);
set_config('board_disable', 0);
page_header($user->lang['Search_indexing']);
?>
@ -303,11 +296,7 @@ if (isset($_POST['start']) || isset($_GET['batchstart']))
}
else if (isset($_POST['cancel']))
{
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '0'
WHERE config_name = 'board_disable'";
$db->sql_query($sql);
set_config('board_disable', 0);
page_header($user->lang['Search_indexing']);
?>

View File

@ -32,13 +32,26 @@ function sql_quote($msg)
function set_config($config_name, $config_value)
{
global $db, $cache, $config;
if (isset($config[$config_name]))
{
$sql = 'UPDATE ' . CONFIG_TABLE . "
SET config_value = '" . sql_escape($config_value) . "'
WHERE config_name = '$config_name'";
$db->sql_query($sql);
}
else
{
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE config_name = "' . $config_name . '"');
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('$config_name', '" . sql_escape($config_value) . "'";
$db->sql_query($sql);
}
$config[$config_name] = $config_value;
$cache->save('config', $config);
$sql = 'UPDATE ' . CONFIG_TABLE . "
SET config_value = '" . sql_escape($config_value) . "'
WHERE config_name = '$config_name'";
$db->sql_query($sql);
}
function get_userdata($user)
@ -689,18 +702,22 @@ function obtain_word_list(&$orig_word, &$replacement_word)
// Redirects the user to another page then exits the script nicely
function redirect($url)
{
global $db, $config;
global $db, $cache, $config;
if (isset($db))
{
$db->sql_close();
}
if (isset($cache))
{
$cache->save_cache();
}
$server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
$server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['server_name']));
$server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/';
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['script_path']));
$url = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($url));
$url = (($script_name == '') ? '' : '/') . preg_replace('/^\/?(.*?)\/?$/', '\1', trim($url));
// Redirect via an HTML form for PITA webservers
if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))