Кеширование списка форумов на главной (минус один тяжелый запрос). Фикс занесения статистики в базу для хобота. И еще пара мелочей. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@521 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08 2013-07-27 17:20:28 +00:00
commit e418373934
5 changed files with 74 additions and 83 deletions

View file

@ -57,7 +57,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 pre-stable';
$bb_cfg['tp_release_date'] = '27-07-2013';
$bb_cfg['tp_release_state'] = 'R520';
$bb_cfg['tp_release_state'] = 'R521';
// Database
$charset = 'utf8';

5
upload/crossdomain.xml Executable file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<allow-access-from domain="*" to-ports="*" secure="false" />
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>

View file

@ -169,21 +169,21 @@ if ($topics_ary && ($mode == 'set_dl_status' || $mode == 'set_topics_dl_status')
}
$new_dlstatus_sql = DB()->build_array('MULTI_INSERT', $new_dlstatus_ary);
if($bb_cfg['announce_type'] == 'xbt')
{
DB()->query("REPLACE INTO ". BB_BT_DLSTATUS_MAIN ." $new_dlstatus_sql");
}
else
{
DB()->query("REPLACE INTO ". BB_BT_DLSTATUS_NEW ." $new_dlstatus_sql");
}
DB()->query("
DELETE FROM ". BB_BT_DLSTATUS_MAIN ."
WHERE user_id = {$user->id}
AND topic_id IN(". join(',', $topics_ary) .")
");
if ($bb_cfg['announce_type'] == 'xbt')
{
DB()->query("REPLACE INTO ". BB_BT_DLSTATUS_MAIN ." $new_dlstatus_sql");
}
else
{
DB()->query("REPLACE INTO ". BB_BT_DLSTATUS_NEW ." $new_dlstatus_sql");
}
redirect("$redirect_type?$redirect");
}

View file

@ -100,15 +100,9 @@ function send_file_to_browser($attachment, $upload_dir)
include(INC_DIR .'functions_torrent.php');
send_torrent_with_passkey($filename);
}
//bt end
// Now the tricky part... let's dance
// @ob_end_clean();
// @ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
// header('Content-Transfer-Encoding: none');
//$real_filename = html_entity_decode(basename($attachment['real_filename']));
$real_filename = clean_filename(basename($attachment['real_filename']));
$mimetype = "{$attachment['mimetype']};";
$charset = (@$lang['CONTENT_ENCODING']) ? "charset={$lang['CONTENT_ENCODING']};" : '';
@ -116,11 +110,9 @@ function send_file_to_browser($attachment, $upload_dir)
// Send out the Headers
header("Content-Type: $mimetype $charset name=\"$real_filename\"");
header("Content-Disposition: inline; filename=\"$real_filename\"");
unset($real_filename);
//
// Now send the File Contents to the Browser
//
if ($gotit)
{
$size = @filesize($filename);
@ -171,9 +163,6 @@ function send_file_to_browser($attachment, $upload_dir)
exit;
}
//
// End Functions
//
//
// Start Session Management
@ -289,9 +278,7 @@ if ($thumbnail)
// Update download count
if (!$thumbnail)
{
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . '
SET download_count = download_count + 1
WHERE attach_id = ' . (int) $attachment['attach_id'];
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET download_count = download_count + 1 WHERE attach_id = ' . (int) $attachment['attach_id'];
if (!DB()->sql_query($sql))
{
@ -325,42 +312,35 @@ if ($download_mode == PHYSICAL_LINK)
else
{
$url = $upload_dir . '/' . $attachment['physical_filename'];
// $url = preg_replace('/^\/?(.*?\/)?$/', '\1', trim($url));
$redirect_path = $server_protocol . $server_name . $server_port . $script_name . $url;
}
// Redirect via an HTML form for PITA webservers
if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
{
header('Refresh: 0; URL=' . $redirect_path);
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="refresh" content="0; url=' . $redirect_path . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $redirect_path . '">HERE</a> to be redirected</div></body></html>';
exit;
}
// Behave as per HTTP/1.1 spec for others
header('Location: ' . $redirect_path);
exit;
}
else
{
if(IS_GUEST && !CAPTCHA()->verify_code())
{
global $template;
if (IS_GUEST && !CAPTCHA()->verify_code())
{
global $template;
$redirect_url = !empty($_POST['redirect_url']) ? $_POST['redirect_url'] : @$_SERVER['HTTP_REFERER'];
$message = '<form action="'. DOWNLOAD_URL . $attachment['attach_id'] .'" method="post">';
$message .= $lang['CONFIRM_CODE'];
$message .= '<div class="mrg_10">'. CAPTCHA()->get_html() .'</div>';
$message .= '<input type="hidden" name="redirect_url" value="'. $redirect_url .'" />';
$message .= '<input type="submit" class="bold" value="'. $lang['SUBMIT'] .'" /> &nbsp;';
$message .= '<input type="button" class="bold" value="Вернуться обратно" onclick="document.location.href = \''. $redirect_url .'\';" />';
$message .= '</form>';
$template->assign_vars(array(
'ERROR_MESSAGE' => $message,
$redirect_url = !empty($_POST['redirect_url']) ? $_POST['redirect_url'] : @$_SERVER['HTTP_REFERER'];
$message = '<form action="'. DOWNLOAD_URL . $attachment['attach_id'] .'" method="post">';
$message .= $lang['CONFIRM_CODE'];
$message .= '<div class="mrg_10">'. CAPTCHA()->get_html() .'</div>';
$message .= '<input type="hidden" name="redirect_url" value="'. $redirect_url .'" />';
$message .= '<input type="submit" class="bold" value="'. $lang['SUBMIT'] .'" /> &nbsp;';
$message .= '<input type="button" class="bold" value="Вернуться обратно" onclick="document.location.href = \''. $redirect_url .'\';" />';
$message .= '</form>';
$template->assign_vars(array(
'ERROR_MESSAGE' => $message,
));
require(PAGE_HEADER);
require(PAGE_FOOTER);
}
}
if (intval($attach_config['allow_ftp_upload']))
{

View file

@ -74,6 +74,7 @@ if ($viewcat AND !$viewcat =& $forums['c'][$viewcat]['cat_id'])
{
redirect("index.php");
}
// Forums
$forums_join_sql = 'f.cat_id = c.cat_id';
$forums_join_sql .= ($viewcat) ? "
@ -124,48 +125,53 @@ $replace_in_parent = array(
'last_topic_id',
);
foreach (DB()->fetch_rowset($sql) as $row)
$cache_name = 'index_sql_' . md5($sql);
if (!$cat_forums = CACHE('bb_cache')->get($cache_name))
{
if (!$cat_id = $row['cat_id'] OR !$forum_id = $row['forum_id'])
foreach (DB()->fetch_rowset($sql) as $row)
{
continue;
}
if ($parent_id = $row['forum_parent'])
{
if (!$parent =& $cat_forums[$cat_id]['f'][$parent_id])
{
$parent = $forums['f'][$parent_id];
$parent['last_post_time'] = 0;
}
if ($row['last_post_time'] > $parent['last_post_time'])
{
foreach ($replace_in_parent as $key)
{
$parent[$key] = $row[$key];
}
}
if ($show_subforums && $row['show_on_index'])
{
$parent['last_sf_id'] = $forum_id;
}
else
if (!$cat_id = $row['cat_id'] OR !$forum_id = $row['forum_id'])
{
continue;
}
}
else
{
$f =& $forums['f'][$forum_id];
$row['forum_desc'] = $f['forum_desc'];
$row['forum_posts'] = $f['forum_posts'];
$row['forum_topics'] = $f['forum_topics'];
}
$cat_forums[$cat_id]['f'][$forum_id] = $row;
if ($parent_id = $row['forum_parent'])
{
if (!$parent =& $cat_forums[$cat_id]['f'][$parent_id])
{
$parent = $forums['f'][$parent_id];
$parent['last_post_time'] = 0;
}
if ($row['last_post_time'] > $parent['last_post_time'])
{
foreach ($replace_in_parent as $key)
{
$parent[$key] = $row[$key];
}
}
if ($show_subforums && $row['show_on_index'])
{
$parent['last_sf_id'] = $forum_id;
}
else
{
continue;
}
}
else
{
$f =& $forums['f'][$forum_id];
$row['forum_desc'] = $f['forum_desc'];
$row['forum_posts'] = $f['forum_posts'];
$row['forum_topics'] = $f['forum_topics'];
}
$cat_forums[$cat_id]['f'][$forum_id] = $row;
}
CACHE('bb_cache')->set($cache_name, $cat_forums, 180);
unset($row);
unset($forums);
$datastore->rm('cat_forums');
}
unset($forums);
$datastore->rm('cat_forums');
// Obtain list of moderators
$moderators = array();