PDA

View Full Version : Обновляем форум phpBB 2.0.13 до 2.0.14


Soniks
16.04.2005, 14:47
Обновляем форум phpBB версии 2.0.13 до версии phpBB 2.0.14

Откройте modules/Forums/admin/admin_styles.php
Найдите:
include($phpbb_root_path. "templates/" . $install_to . "/theme_info.cfg");
Замените на:
include($phpbb_root_path. "templates/" . basename($install_to) . "/theme_info.cfg");
Найдите:
$fp = @fopen($phpbb_root_path . 'templates/' . $template_name . '/theme_info.cfg', 'w');
Замените на:
$fp = @fopen($phpbb_root_path . 'templates/' . basename($template_name) . '/theme_info.cfg', 'w');
Откройте modules/Forums/admin/page_header_admin.php
Найдите:
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
Замените на:
$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
Откройте modules/Forums/admin/page_footer_admin.php
Найдите:
'PHPBB_VERSION' => '2' . $board_config['version'],
Замените на:
'PHPBB_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? '2' . $board_config['version'] : '',

Откройте db/postgres7.php
Найдите:
$query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $query);
После добавьте:
$query = preg_replace('#(.*WHERE.*)(username|user_email|ban_emai l) = \'(.*)\'#ise', "\"\\1LOWER(\\2) = '\" . strtolower('\\3') . \"'\"", $query);
Откройте includes/page_header.php
Найдите:
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
Замените на:
$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
Найдите:
if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
Замените на:
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
Откройте includes/sessions.php
Найдите (58 строка):
$session_id = '';
}
После добавьте:
$page_id = (int) $page_id;
Найдите:

// No match; don't login, set as anonymous user
$login = 0;
$enable_autologin = 0;
$user_id = $userdata['user_id'] = ANONYMOUS;
После добавьте:

$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS;
$result = $db->sql_query($sql);
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Найдите:

// Autologin is not set. Don't login, set as anonymous user
$login = 0;
$enable_autologin = 0;
$user_id = $userdata['user_id'] = ANONYMOUS;
После добавьте:

$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS;
$result = $db->sql_query($sql);
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Найдите:

//
// Does a session exist?
//

До этого добавьте:
$thispage_id = (int) $thispage_id;
Откройте modules/Forums/modcp.php
Найдите:
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$topic_row = $db->sql_fetchrow($result);
После добавьте:

if (!$topic_row)
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
Найдите:
message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
$topic_row = $db->sql_fetchrow($result);
После добавьте:
if (!$topic_row)
{
message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
Откройте modules/Private_Messages/index.php
Найдите:
if ( !$board_config['allow_html'] )
{
if ( $user_sig != '' && $privmsg['privmsgs_enable_sig'] && $userdata['user_allowhtml'] )
Замените на:
if ( !$board_config['allow_html'] || !$userdata['user_allowhtml'])
{
if ( $user_sig != '')
Найдите:
if ( !$html_on )
{
if ( $user_sig != '' || !$userdata['user_allowhtml'] )
Замените на:
if ( !$html_on || !$board_config['allow_html'] || !$userdata['user_allowhtml'] )
{
if ( $user_sig != '' )
Откройте modules/Forums/search.php
Найдите:
$search_author = str_replace('*', '%', trim($search_author));
До этого добавьте:

if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
{
$search_author = '';
}
Найдите:
for($i = 0; $i < count($split_search); $i++)
{

После добавьте:
if (preg_match('#^[\*%]+$#', trim($split_search[$i])) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i]))))
{
$split_search[$i] = '';
continue;
}
Найдите:

// Author name search
//
if ( $search_author != '' )
{

После этого добавьте:

if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
{
$search_author = '';
}
Откройте modules/Forums/viewtopic.php
Найдите:
if ( !$board_config['allow_html'] )
{
if ( $user_sig != '' && $userdata['user_allowhtml'] )
Замените на:
if ( !$board_config['allow_html'] || !$userdata['user_allowhtml'])
{
if ( $user_sig != '' )
Найдите:
$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^ ><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}

$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^ ><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
Замените на:
$user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([ ^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}

$message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([ ^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
Выполните SQL запрос:
UPDATE nuke_bbconfig SET config_value='.0.14' where config_name='version'
заменив nuke_ на свой префикс!

Все обновление Выполнено! :cool:

BriaN
16.04.2005, 18:04
Откройте includes/sessions.php

Найдите:

$session_id = '';
}

После добавьте:

$page_id = (int) $page_id;


$session_id = ''; эту строку надо найти и добавить после неё $page_id = (int) $page_id; где то на 58 строке так как приблизительно на 272 строке есть ещё одна переменная $session_id = ''; там не надо добовлять $page_id = (int) $page_id;.



Найдите:

$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^ ><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));


Замените на:

$user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([ ^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}

$message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([ ^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));


Тут небольшая ошибка соника надо заменить не только строку:

$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^ ><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));

а и строку

$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));

так что правельно будет заменить вот так:

Найдите:

$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}

$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));

Замените на:

$user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([ ^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}

$message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([ ^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));


Всё остальное как надо :wink:

Soniks
16.04.2005, 18:27
BriaN спасибо, подправил!