Временный костыль для topic_dl_type Еще немного правок git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@509 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
gemini_13@torba.su 2013-06-28 23:57:30 +00:00
commit f53a73ba85
6 changed files with 90 additions and 91 deletions

View file

@ -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,17 +101,10 @@ 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)
{
$seeders = $row['seeders'];
$leechers = $row['leechers'];
$msg_error = "HAVE_SEED";
}
}
$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'];
@ -128,6 +121,14 @@ function call_seed($topic_id, $t_info, $to_user_id)
call_seed($topic_id, $t_info, $user_id);
}
}
else
{
$seeders = $row['seeders'];
$leechers = $row['leechers'];
$msg_error = "HAVE_SEED";
}
}
$msg = '';
meta_refresh("viewtopic.php?t=$topic_id", 8);

View file

@ -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;

View file

@ -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 = '<select name="'. $select_name .'">';
foreach ($bb_cfg['templates'] as $template)
{
$selected = '';
if ($template['dirname'] == $default) $selected = ' selected="selected"';
$templates_select .= '<option value="'. $template['dirname'] .'"'. $selected .'>'. $template['title'] .'</option>';
}
$templates_select .= '</select>&nbsp;';
return $templates_select;
}
// Create date/time from format and timezone
function bb_date ($gmepoch, $format = false, $tz = null)
{

View file

@ -83,3 +83,21 @@ function tz_select($default, $select_name = 'timezone')
return $tz_select;
}
//
// Templates
//
function templates_select($default_style, $select_name = 'tpl_name')
{
global $bb_cfg;
$templates_select = '<select name="'. $select_name .'">';
foreach ($bb_cfg['templates'] as $folder => $name)
{
$selected = '';
if ($folder == $default_style) $selected = ' selected="selected"';
$templates_select .= '<option value="'. $folder .'"'. $selected .'>'. $name .'</option>';
}
$templates_select .= '</select>&nbsp;';
return $templates_select;
}

View file

@ -721,22 +721,17 @@ foreach ($profile_fields as $field => $can_edit)
}
break;
/**
* Выбор шаблона (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'])
{
$pr_data['tpl_name'] = $bb_cfg['tpl_name'];
$db_data['tpl_name'] = (string) $bb_cfg['tpl_name'];
foreach ($bb_cfg['templates'] as $temptemplate)
{
if ($templates == $temptemplate['dirname'])
{
$pr_data['tpl_name'] = $templates;
$db_data['tpl_name'] = (string) $templates;
}
}
}
$tp_data['TEMPLATES_SELECT'] = templates_select($pr_data['tpl_name'], 'tpl_name');
break;

View file

@ -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,8 +789,17 @@ 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']))
{
$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']))
{
if (!$topic_type_toggle)
{
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ';
@ -811,6 +820,7 @@ if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod'])
$topic_type_toggle .= '<nobr><input type="checkbox" name="'. $dl_type_name .'" id="topic_dl_type_id" '. $dl_ds . $dl_ch .' /><label for="topic_dl_type_id"> '.$lang['POST_DOWNLOAD'].'</label></nobr>';
$topic_type_toggle .= $dl_hid;
}
}
//bt end