mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
- some bugfixes
git-svn-id: file:///svn/phpbb/trunk@5255 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
5449c591a9
commit
1981196e99
8 changed files with 84 additions and 69 deletions
|
@ -1575,65 +1575,6 @@ function delete_forum_content($forum_id)
|
|||
$db->sql_transaction('commit');
|
||||
}
|
||||
|
||||
function recalc_btree()
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = 'SELECT forum_id, parent_id, left_id, right_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
ORDER BY parent_id ASC';
|
||||
$f_result = $db->sql_query($sql);
|
||||
|
||||
while ($forum_data = $db->sql_fetchrow($f_result))
|
||||
{
|
||||
if ($forum_data['parent_id'])
|
||||
{
|
||||
$sql = 'SELECT left_id, right_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id = ' . $forum_data['parent_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if (!$row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . ' SET parent_id = 0 WHERE forum_id = ' . $forum_data['forum_id'];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET left_id = left_id + 2, right_id = right_id + 2
|
||||
WHERE left_id > ' . $row['right_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET right_id = right_id + 2
|
||||
WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id';
|
||||
$db->sql_query($sql);
|
||||
|
||||
$forum_data['left_id'] = $row['right_id'];
|
||||
$forum_data['right_id'] = $row['right_id'] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT MAX(right_id) AS right_id
|
||||
FROM ' . FORUMS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$forum_data['left_id'] = $row['right_id'] + 1;
|
||||
$forum_data['right_id'] = $row['right_id'] + 2;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . '
|
||||
SET left_id = ' . $forum_data['left_id'] . ', right_id = ' . $forum_data['right_id'] . '
|
||||
WHERE forum_id = ' . $forum_data['forum_id'];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$db->sql_freeresult($f_result);
|
||||
}
|
||||
|
||||
//
|
||||
// End function block
|
||||
// ------------------
|
||||
|
|
|
@ -16,7 +16,7 @@ class acm
|
|||
{
|
||||
var $vars = array();
|
||||
var $var_expires = array();
|
||||
var $is_modified = FALSE;
|
||||
var $is_modified = false;
|
||||
|
||||
var $sql_rowset = array();
|
||||
|
||||
|
@ -65,7 +65,7 @@ class acm
|
|||
fclose($fp);
|
||||
}
|
||||
|
||||
$this->is_modified = FALSE;
|
||||
$this->is_modified = false;
|
||||
}
|
||||
|
||||
function tidy()
|
||||
|
@ -80,7 +80,7 @@ class acm
|
|||
continue;
|
||||
}
|
||||
|
||||
$expired = TRUE;
|
||||
$expired = true;
|
||||
include($this->cache_dir . $entry);
|
||||
if ($expired)
|
||||
{
|
||||
|
|
|
@ -1619,7 +1619,7 @@ function page_header($page_title = '')
|
|||
'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/",
|
||||
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
|
||||
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
|
||||
'T_STYLESHEET_LINK' => (!$user->theme['primary']['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['primary']['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['primary']['theme_id'],
|
||||
'T_STYLESHEET_LINK' => (!$user->theme['primary']['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['primary']['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['primary']['style_id'],
|
||||
'T_STYLESHEET_NAME' => $user->theme['primary']['theme_name'],
|
||||
'T_THEME_DATA' => (!$user->theme['primary']['theme_storedb']) ? '' : $user->theme['primary']['theme_data'])
|
||||
);
|
||||
|
|
|
@ -8,6 +8,79 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Recalculate Binary Tree
|
||||
*/
|
||||
function recalc_btree($sql_id, $sql_table)
|
||||
{
|
||||
global $db;
|
||||
|
||||
/* Init table, id's, etc...
|
||||
$sql_id = 'module_id'; // 'forum_id'
|
||||
$sql_table = MODULES_TABLE; // FORUMS_TABLE
|
||||
*/
|
||||
|
||||
if (!$sql_id || !$sql_table)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = "SELECT $sql_id, parent_id, left_id, right_id
|
||||
FROM $sql_table
|
||||
ORDER BY left_id ASC, parent_id ASC, $sql_id ASC";
|
||||
$f_result = $db->sql_query($sql);
|
||||
|
||||
while ($item_data = $db->sql_fetchrow($f_result))
|
||||
{
|
||||
if ($item_data['parent_id'])
|
||||
{
|
||||
$sql = "SELECT left_id, right_id
|
||||
FROM $sql_table
|
||||
WHERE $sql_id = {$item_data['parent_id']}";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if (!$row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql = "UPDATE $sql_table SET parent_id = 0 WHERE $sql_id = " . $item_data[$sql_id];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "UPDATE $sql_table
|
||||
SET left_id = left_id + 2, right_id = right_id + 2
|
||||
WHERE left_id > {$row['right_id']}";
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = "UPDATE $sql_table
|
||||
SET right_id = right_id + 2
|
||||
WHERE {$row['left_id']} BETWEEN left_id AND right_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
$item_data['left_id'] = $row['right_id'];
|
||||
$item_data['right_id'] = $row['right_id'] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT MAX(right_id) AS right_id
|
||||
FROM $sql_table";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$item_data['left_id'] = $row['right_id'] + 1;
|
||||
$item_data['right_id'] = $row['right_id'] + 2;
|
||||
}
|
||||
|
||||
$sql = "UPDATE $sql_table
|
||||
SET left_id = {$item_data['left_id']}, right_id = {$item_data['right_id']}
|
||||
WHERE $sql_id = " . $item_data[$sql_id];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$db->sql_freeresult($f_result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple version of jumpbox, just lists authed forums
|
||||
*/
|
||||
|
|
|
@ -1232,7 +1232,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr
|
|||
'folder_id' => PRIVMSGS_NO_BOX,
|
||||
'new' => 1,
|
||||
'unread' => 1,
|
||||
'forwarded' => ($mode == 'forward') ? 1 : 0))
|
||||
'forwarded' => ($mode == 'forward') ? 1 : 0
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1243,7 +1243,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr
|
|||
case 'mysql':
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
$db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary);
|
||||
$db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -842,7 +842,7 @@ class user extends session
|
|||
);
|
||||
|
||||
$db->sql_query('UPDATE ' . STYLES_CSS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE theme_id = ' . $style);
|
||||
WHERE theme_id = ' . $this->theme['primary']['theme_id']);
|
||||
|
||||
unset($sql_ary);
|
||||
}
|
||||
|
|
|
@ -384,7 +384,7 @@ function report_notification($notify_user, $report_post, $report_data)
|
|||
'address_list' => array('u' => array($user_id => 'to')),
|
||||
'from_user_id' => $user->data['user_id'],
|
||||
'from_user_ip' => $user->ip,
|
||||
'from_usernae' => $user->data['username'],
|
||||
'from_username' => $user->data['username'],
|
||||
'icon_id' => 0,
|
||||
'enable_bbcode' => 0,
|
||||
'enable_html' => 0,
|
||||
|
|
|
@ -37,10 +37,11 @@ if (!empty($_GET['id']) && !empty($_GET['sid']))
|
|||
{
|
||||
// Include files
|
||||
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
|
||||
require($phpbb_root_path . 'includes/acm/acm_main.' . $phpEx);
|
||||
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
|
||||
|
||||
$db = new $sql_db();
|
||||
$cache = new acm();
|
||||
$cache = new cache();
|
||||
|
||||
// Connect to DB
|
||||
if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false))
|
||||
|
@ -65,7 +66,7 @@ if (!empty($_GET['id']) && !empty($_GET['sid']))
|
|||
AND t.template_id = s.template_id
|
||||
AND c.theme_id = s.theme_id
|
||||
AND i.imageset_id = s.imageset_id";
|
||||
$result2 = $db->sql_query($sql, 300);
|
||||
$result2 = $db->sql_query($sql);
|
||||
|
||||
if (!($theme = $db->sql_fetchrow($result2)))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue