diff --git a/upload/callseed.php b/upload/callseed.php
index 0e0ade503..d3503db43 100644
--- a/upload/callseed.php
+++ b/upload/callseed.php
@@ -87,7 +87,7 @@ function call_seed($topic_id, $t_info, $to_user_id)
if($cp <= $pause)
{
$cur_pause_hour = floor($pcp/3600);
- $cur_pause_min = floor($pcp/60)/*-($cur_pause_hour*60)*/;
+ $cur_pause_min = floor($pcp/60);
$msg_error = "SPAM";
}
}
@@ -101,8 +101,28 @@ function call_seed($topic_id, $t_info, $to_user_id)
{
$sql = "SELECT seeders, leechers FROM ". BB_BT_TRACKER_SNAP ." WHERE topic_id = $topic_id LIMIT 1";
$row = DB()->fetch_row($sql);
- if ($row['seeders'] > 2)
- #if ( !in_array($userdata['user_level'], array(ADMIN, MOD)) )
+ if ($row['seeders'] <= 2)
+ {
+ $sql = "SELECT user_id FROM ". BB_BT_DLSTATUS ." WHERE topic_id = $topic_id AND user_id != {$userdata['user_id']}";
+
+ foreach(DB()->fetch_rowset($sql) as $row)
+ {
+ $u_id[] = $row['user_id'];
+ }
+ if (!in_array($t_info['topic_poster'], $u_id))
+ {
+ $u_id[] = $t_info['topic_poster'];
+ }
+ array_unique($u_id);
+
+ foreach($u_id as $i=>$user_id)
+ {
+ if ($msg_error != "OK") break;
+
+ call_seed($topic_id, $t_info, $user_id);
+ }
+ }
+ else
{
$seeders = $row['seeders'];
$leechers = $row['leechers'];
@@ -110,25 +130,6 @@ function call_seed($topic_id, $t_info, $to_user_id)
}
}
- $sql = "SELECT user_id FROM ". BB_BT_DLSTATUS ." WHERE topic_id = $topic_id AND user_id != {$userdata['user_id']}";
- /*$row = DB()->fetch_rowset($sql);*/
- foreach(DB()->fetch_rowset($sql) as $row)
- {
- $u_id[] = $row['user_id'];
- }
- if (!in_array($t_info['topic_poster'], $u_id))
- {
- $u_id[] = $t_info['topic_poster'];
- }
- array_unique($u_id);
-
- foreach($u_id as $i=>$user_id)
- {
- if ($msg_error != "OK") break;
-
- call_seed($topic_id, $t_info, $user_id);
- }
-
$msg = '';
meta_refresh("viewtopic.php?t=$topic_id", 8);
$return_to = sprintf ($lang['CALLSEED_RETURN'], $topic_id);
diff --git a/upload/config.php b/upload/config.php
index 72fea002f..926788dda 100644
--- a/upload/config.php
+++ b/upload/config.php
@@ -56,8 +56,8 @@ $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'] = '28-06-2013';
-$bb_cfg['tp_release_state'] = 'R508';
+$bb_cfg['tp_release_date'] = '29-06-2013';
+$bb_cfg['tp_release_state'] = 'R509';
// Database
$charset = 'utf8';
@@ -261,11 +261,12 @@ else
// Templates
define('ADMIN_TPL_DIR', TEMPLATES_DIR .'/admin/');
-// Template 1 (template 2 is $bb_cfg['templates'][1], template 3 is $bb_cfg['templates'][2]...)
-$bb_cfg['templates'][0]['dirname'] = 'default';
-$bb_cfg['templates'][0]['title'] = 'Стандартный';
+$bb_cfg['templates'] = array(
+// 'folder' => 'Name',
+ 'default' => 'Стандартный'
+);
-$bb_cfg['tpl_name'] = $bb_cfg['templates'][0]['dirname'];
+$bb_cfg['tpl_name'] = 'default';
$bb_cfg['stylesheet'] = 'main.css';
$bb_cfg['show_sidebar1_on_every_page'] = false;
diff --git a/upload/includes/functions.php b/upload/includes/functions.php
index 9160a2975..caddb8f64 100644
--- a/upload/includes/functions.php
+++ b/upload/includes/functions.php
@@ -1550,20 +1550,9 @@ function setup_style ()
global $bb_cfg, $template, $userdata;
// AdminCP works only with default template
- $tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($bb_cfg['tpl_name']);
+ $tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename((IS_GUEST || empty($userdata['tpl_name'])) ? $bb_cfg['tpl_name'] : $userdata['tpl_name']);
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($bb_cfg['stylesheet']);
- if (!empty($userdata['tpl_name']))
- {
- foreach ($bb_cfg['templates'] as $temptemplate)
- {
- if ($userdata['tpl_name'] == $temptemplate['dirname'])
- {
- $tpl_dir_name = basename($userdata['tpl_name']);
- }
- }
- }
-
$template = new Template(TEMPLATES_DIR . $tpl_dir_name);
$css_dir = basename(TEMPLATES_DIR) ."/$tpl_dir_name/css/";
@@ -1583,21 +1572,6 @@ function setup_style ()
return $theme;
}
-function templates_select($default, $select_name = 'tpl_name')
-{
- global $bb_cfg;
-
- $templates_select = ' ';
- return $templates_select;
-}
-
// Create date/time from format and timezone
function bb_date ($gmepoch, $format = false, $tz = null)
{
diff --git a/upload/includes/functions_selects.php b/upload/includes/functions_selects.php
index cedbd04f3..e1e03e40f 100644
--- a/upload/includes/functions_selects.php
+++ b/upload/includes/functions_selects.php
@@ -82,4 +82,22 @@ function tz_select($default, $select_name = 'timezone')
$tz_select .= '';
return $tz_select;
+}
+
+//
+// Templates
+//
+function templates_select($default_style, $select_name = 'tpl_name')
+{
+ global $bb_cfg;
+
+ $templates_select = ' ';
+ return $templates_select;
}
\ No newline at end of file
diff --git a/upload/includes/ucp/usercp_register.php b/upload/includes/ucp/usercp_register.php
index 2001d6a5d..4586b3613 100644
--- a/upload/includes/ucp/usercp_register.php
+++ b/upload/includes/ucp/usercp_register.php
@@ -721,24 +721,19 @@ foreach ($profile_fields as $field => $can_edit)
}
break;
- case 'tpl_name':
- $templates = isset($_POST['tpl_name']) ? (string) $_POST['tpl_name'] : $pr_data['tpl_name'];
- $templates = htmlCHR($templates);
- if ($submit && $templates != $pr_data['tpl_name'])
- {
- $pr_data['tpl_name'] = $bb_cfg['tpl_name'];
- $db_data['tpl_name'] = (string) $bb_cfg['tpl_name'];
- foreach ($bb_cfg['templates'] as $temptemplate)
+ /**
+ * Выбор шаблона (edit, reg)
+ */
+ case 'tpl_name':
+ $templates = isset($_POST['tpl_name']) ? (string) $_POST['tpl_name'] : $pr_data['tpl_name'];
+ $templates = htmlCHR($templates);
+ if ($submit && $templates != $pr_data['tpl_name'])
{
- if ($templates == $temptemplate['dirname'])
- {
- $pr_data['tpl_name'] = $templates;
- $db_data['tpl_name'] = (string) $templates;
- }
+ $pr_data['tpl_name'] = $templates;
+ $db_data['tpl_name'] = (string) $templates;
}
- }
- $tp_data['TEMPLATES_SELECT'] = templates_select($pr_data['tpl_name'], 'tpl_name');
- break;
+ $tp_data['TEMPLATES_SELECT'] = templates_select($pr_data['tpl_name'], 'tpl_name');
+ break;
/**
* default
diff --git a/upload/posting.php b/upload/posting.php
index 30bc3db05..513a5bae6 100644
--- a/upload/posting.php
+++ b/upload/posting.php
@@ -562,7 +562,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
- if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg&& !$to_draft)
+ if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg && !$to_draft)
{
include(INC_DIR .'functions_torrent.php');
if(!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
@@ -789,28 +789,38 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
//bt
$topic_dl_type = (isset($post_info['topic_dl_type'])) ? $post_info['topic_dl_type'] : 0;
-if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod'])
+if ($post_info['allow_reg_tracker'] && $post_data['first_post'] && ($topic_dl_type || $is_auth['auth_mod']))
{
- if (!$topic_type_toggle)
+ $sql = "
+ SELECT tor.attach_id
+ FROM ". BB_POSTS ." p
+ LEFT JOIN ". BB_BT_TORRENTS ." tor ON (p.post_id = tor.post_id)
+ WHERE p.post_id = $post_id
+ ";
+ $result = DB()->fetch_row($sql);
+ if(!empty($result['attach_id']))
{
- $topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ';
+ if (!$topic_type_toggle)
+ {
+ $topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ';
+ }
+
+ $dl_ds = $dl_ch = $dl_hid = '';
+ $dl_type_name = 'topic_dl_type';
+ $dl_type_val = ($topic_dl_type) ? 1 : 0;
+
+ if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod'])
+ {
+ $dl_ds = ' disabled="disabled" ';
+ $dl_hid = '';
+ $dl_type_name = '';
+ }
+
+ $dl_ch = ($mode == 'editpost' && $post_data['first_post'] && $topic_dl_type) ? ' checked="checked" ' : '';
+
+ $topic_type_toggle .= '';
+ $topic_type_toggle .= $dl_hid;
}
-
- $dl_ds = $dl_ch = $dl_hid = '';
- $dl_type_name = 'topic_dl_type';
- $dl_type_val = ($topic_dl_type) ? 1 : 0;
-
- if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod'])
- {
- $dl_ds = ' disabled="disabled" ';
- $dl_hid = '';
- $dl_type_name = '';
- }
-
- $dl_ch = ($mode == 'editpost' && $post_data['first_post'] && $topic_dl_type) ? ' checked="checked" ' : '';
-
- $topic_type_toggle .= '';
- $topic_type_toggle .= $dl_hid;
}
//bt end