diff --git a/upload/config.php b/upload/config.php index 3f9c23113..8aca9394a 100644 --- a/upload/config.php +++ b/upload/config.php @@ -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'; diff --git a/upload/crossdomain.xml b/upload/crossdomain.xml new file mode 100755 index 000000000..8778daec1 --- /dev/null +++ b/upload/crossdomain.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/upload/dl_list.php b/upload/dl_list.php index d880596d9..f316dfe10 100644 --- a/upload/dl_list.php +++ b/upload/dl_list.php @@ -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"); } diff --git a/upload/download.php b/upload/download.php index b8697c551..20acc6827 100644 --- a/upload/download.php +++ b/upload/download.php @@ -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 'Redirect
If your browser does not support meta redirection please click HERE to be redirected
'; - 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 = '
'; - $message .= $lang['CONFIRM_CODE']; - $message .= '
'. CAPTCHA()->get_html() .'
'; - $message .= ''; - $message .= '  '; - $message .= ''; - $message .= '
'; - $template->assign_vars(array( - 'ERROR_MESSAGE' => $message, + $redirect_url = !empty($_POST['redirect_url']) ? $_POST['redirect_url'] : @$_SERVER['HTTP_REFERER']; + $message = '
'; + $message .= $lang['CONFIRM_CODE']; + $message .= '
'. CAPTCHA()->get_html() .'
'; + $message .= ''; + $message .= '  '; + $message .= ''; + $message .= '
'; + + $template->assign_vars(array( + 'ERROR_MESSAGE' => $message, )); + require(PAGE_HEADER); require(PAGE_FOOTER); - } + } if (intval($attach_config['allow_ftp_upload'])) { diff --git a/upload/index.php b/upload/index.php index fb11d1613..63334ddef 100644 --- a/upload/index.php +++ b/upload/index.php @@ -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();