mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r509
Временный костыль для topic_dl_type Еще немного правок git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@509 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
1b2aeb42e4
commit
f53a73ba85
6 changed files with 90 additions and 91 deletions
|
@ -87,7 +87,7 @@ function call_seed($topic_id, $t_info, $to_user_id)
|
||||||
if($cp <= $pause)
|
if($cp <= $pause)
|
||||||
{
|
{
|
||||||
$cur_pause_hour = floor($pcp/3600);
|
$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";
|
$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";
|
$sql = "SELECT seeders, leechers FROM ". BB_BT_TRACKER_SNAP ." WHERE topic_id = $topic_id LIMIT 1";
|
||||||
$row = DB()->fetch_row($sql);
|
$row = DB()->fetch_row($sql);
|
||||||
if ($row['seeders'] > 2)
|
if ($row['seeders'] <= 2)
|
||||||
#if ( !in_array($userdata['user_level'], array(ADMIN, MOD)) )
|
{
|
||||||
|
$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'];
|
$seeders = $row['seeders'];
|
||||||
$leechers = $row['leechers'];
|
$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 = '';
|
$msg = '';
|
||||||
meta_refresh("viewtopic.php?t=$topic_id", 8);
|
meta_refresh("viewtopic.php?t=$topic_id", 8);
|
||||||
$return_to = sprintf ($lang['CALLSEED_RETURN'], $topic_id);
|
$return_to = sprintf ($lang['CALLSEED_RETURN'], $topic_id);
|
||||||
|
|
|
@ -56,8 +56,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
|
||||||
|
|
||||||
// Increase number of revision after update
|
// Increase number of revision after update
|
||||||
$bb_cfg['tp_version'] = '2.5 pre-stable';
|
$bb_cfg['tp_version'] = '2.5 pre-stable';
|
||||||
$bb_cfg['tp_release_date'] = '28-06-2013';
|
$bb_cfg['tp_release_date'] = '29-06-2013';
|
||||||
$bb_cfg['tp_release_state'] = 'R508';
|
$bb_cfg['tp_release_state'] = 'R509';
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$charset = 'utf8';
|
$charset = 'utf8';
|
||||||
|
@ -261,11 +261,12 @@ else
|
||||||
// Templates
|
// Templates
|
||||||
define('ADMIN_TPL_DIR', TEMPLATES_DIR .'/admin/');
|
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'] = array(
|
||||||
$bb_cfg['templates'][0]['dirname'] = 'default';
|
// 'folder' => 'Name',
|
||||||
$bb_cfg['templates'][0]['title'] = 'Стандартный';
|
'default' => 'Стандартный'
|
||||||
|
);
|
||||||
|
|
||||||
$bb_cfg['tpl_name'] = $bb_cfg['templates'][0]['dirname'];
|
$bb_cfg['tpl_name'] = 'default';
|
||||||
$bb_cfg['stylesheet'] = 'main.css';
|
$bb_cfg['stylesheet'] = 'main.css';
|
||||||
|
|
||||||
$bb_cfg['show_sidebar1_on_every_page'] = false;
|
$bb_cfg['show_sidebar1_on_every_page'] = false;
|
||||||
|
|
|
@ -1550,20 +1550,9 @@ function setup_style ()
|
||||||
global $bb_cfg, $template, $userdata;
|
global $bb_cfg, $template, $userdata;
|
||||||
|
|
||||||
// AdminCP works only with default template
|
// 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']);
|
$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);
|
$template = new Template(TEMPLATES_DIR . $tpl_dir_name);
|
||||||
$css_dir = basename(TEMPLATES_DIR) ."/$tpl_dir_name/css/";
|
$css_dir = basename(TEMPLATES_DIR) ."/$tpl_dir_name/css/";
|
||||||
|
|
||||||
|
@ -1583,21 +1572,6 @@ function setup_style ()
|
||||||
return $theme;
|
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> ';
|
|
||||||
return $templates_select;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create date/time from format and timezone
|
// Create date/time from format and timezone
|
||||||
function bb_date ($gmepoch, $format = false, $tz = null)
|
function bb_date ($gmepoch, $format = false, $tz = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,4 +82,22 @@ function tz_select($default, $select_name = 'timezone')
|
||||||
$tz_select .= '</select>';
|
$tz_select .= '</select>';
|
||||||
|
|
||||||
return $tz_select;
|
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> ';
|
||||||
|
return $templates_select;
|
||||||
}
|
}
|
|
@ -721,24 +721,19 @@ foreach ($profile_fields as $field => $can_edit)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'tpl_name':
|
/**
|
||||||
$templates = isset($_POST['tpl_name']) ? (string) $_POST['tpl_name'] : $pr_data['tpl_name'];
|
* Выбор шаблона (edit, reg)
|
||||||
$templates = htmlCHR($templates);
|
*/
|
||||||
if ($submit && $templates != $pr_data['tpl_name'])
|
case 'tpl_name':
|
||||||
{
|
$templates = isset($_POST['tpl_name']) ? (string) $_POST['tpl_name'] : $pr_data['tpl_name'];
|
||||||
$pr_data['tpl_name'] = $bb_cfg['tpl_name'];
|
$templates = htmlCHR($templates);
|
||||||
$db_data['tpl_name'] = (string) $bb_cfg['tpl_name'];
|
if ($submit && $templates != $pr_data['tpl_name'])
|
||||||
foreach ($bb_cfg['templates'] as $temptemplate)
|
|
||||||
{
|
{
|
||||||
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');
|
||||||
$tp_data['TEMPLATES_SELECT'] = templates_select($pr_data['tpl_name'], 'tpl_name');
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default
|
* default
|
||||||
|
|
|
@ -562,7 +562,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
|
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');
|
include(INC_DIR .'functions_torrent.php');
|
||||||
if(!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
|
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
|
//bt
|
||||||
$topic_dl_type = (isset($post_info['topic_dl_type'])) ? $post_info['topic_dl_type'] : 0;
|
$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 = '<input type="hidden" name="topic_dl_type" value="'. $dl_type_val .'" />';
|
||||||
|
$dl_type_name = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$dl_ch = ($mode == 'editpost' && $post_data['first_post'] && $topic_dl_type) ? ' checked="checked" ' : '';
|
||||||
|
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
$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 = '<input type="hidden" name="topic_dl_type" value="'. $dl_type_val .'" />';
|
|
||||||
$dl_type_name = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$dl_ch = ($mode == 'editpost' && $post_data['first_post'] && $topic_dl_type) ? ' checked="checked" ' : '';
|
|
||||||
|
|
||||||
$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
|
//bt end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue