|
Форум torrenpier который уже живет
это сообщество владельцев форумов на phphBB2, торрент-трекеров на движках torrentpier и SVN всех версий.
Здесь можно найти решение своих проблем на своем сайта. Здесь можно скачать полезные и нужные моды torrenpier, phpBB2 и svn. Наш форум - это место для общения и обмена опытом между любителей движков, создателей модов на заказ и владельцев сайтов!
|
Автор |
Сообщение |
Mercedec Гость
|
31-Янв-11 22:00 |
#1 |
Код: | #-----[ COPY ]------------------------------------------
#
copy silver_gold_unset.php /includes/cron/job/
copy calendar/* to /misc/calendar/
copy date.png to /images/
#
#-----[ SQL ]-------------------------------------------
#
ALTER TABLE bb_bt_torrents ADD tor_type_time int(11) not null default -1 after tor_type;
INSERT INTO `bb_cron` VALUES (NULL, 1, 'Change gold_silver', 'silver_gold_unset.php', 'interval', NULL, NULL, 255, '0', '0', '00:10:00', 0, '', 0, 0, 0);
#
#-----[ OPEN ]------------------------------------------
#
templates/default/viewtopic_attach.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN tor_reged -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- IF postrow.attach.tor_reged.TOR_SILVER_GOLD == 1 || postrow.attach.tor_reged.TOR_SILVER_GOLD == 2 && postrow.attach.tor_reged.TOR_TIME > 1 -->
<script language=JavaScript type=text/javascript>
function fulltime () {
var time=new Date();
var newStat=new Date("{postrow.attach.tor_reged.TOR_TIME_SET}");
var totalRemains=(newStat.getTime()-time.getTime());
if (totalRemains>1){
var RemainsSec = (parseInt(totalRemains/1000));//5
var RemainsFullDays=(parseInt(RemainsSec/(24*60*60)));
var secInLastDay=RemainsSec-RemainsFullDays*24*3600;
var RemainsFullHours=(parseInt(secInLastDay/3600));
if (RemainsFullHours<10 && RemainsFullHours > 0) RemainsFullHours="0"+RemainsFullHours;
var secInLastHour=secInLastDay-RemainsFullHours*3600;//5
var RemainsMinutes=(parseInt(secInLastHour/60));//51
if (RemainsMinutes<10) RemainsMinutes="0"+RemainsMinutes;
var lastSec=secInLastHour-RemainsMinutes*60;
if (lastSec<10){lastSec="0"+lastSec};
if(RemainsFullDays) $('#day').text(RemainsFullDays+'дн. ');
if(RemainsFullHours) $('#hour').text(RemainsFullHours+'ч. ');
$('#min').text(RemainsMinutes+'мин. ');
$('#sec').text(lastSec+"сек. ");
setTimeout('fulltime()',10)
}
else{
$('#change').text('Статус сменится через несколько минут');
}
}
</script>
<!-- ENDIF -->
#
#-----[ FIND ]------------------------------------------
#
· <span id="tor-{TOPIC_ID}-user">{postrow.attach.tor_reged.TOR_STATUS_BY}</span>
</span>
<!-- IF AUTH_MOD -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<script src="./misc/calendar/js/jscal2.js"></script>
<script src="./misc/calendar/js/lang/ru.js"></script>
<link rel="stylesheet" type="text/css" href="./misc/calendar/css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="./misc/calendar/css/border-radius.css" />
<link rel="stylesheet" type="text/css" href="./misc/calendar/css/gold/gold.css" />
#
#-----[ FIND ]------------------------------------------
#
<!-- IF postrow.attach.tor_reged.TOR_SILVER_GOLD == 2 -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" /> {L_SILVER_STATUS} <img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" /></th>
</tr>
<!-- ELSEIF postrow.attach.tor_reged.TOR_SILVER_GOLD == 1 -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" /> {L_GOLD_STATUS} <img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" /></th>
</tr>
<!-- ENDIF -->
#
#-----[ REPLASE TO ]------------------------------------------
#
<!-- IF postrow.attach.tor_reged.TOR_SILVER_GOLD == 2 -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" /> {L_SILVER_STATUS} <img src="images/tor_silver.gif" width="16" height="15" title="{L_SILVER}" /></th>
</tr>
<tr class="row4" align="center">
<td colspan=2>
<tr class="row4" align="center">
<td colspan=3>
<!-- IF postrow.attach.tor_reged.TOR_TIME > 0 -->
<b>Осталось: <span id="change"><span id="day"></span><span id="hour"></span><span id="min"></span><span id="sec"></span></span></b><script language=JavaScript>fulltime();</script> [ {postrow.attach.tor_reged.TOR_TIME_SET1} ]
<!-- ELSE -->
<b>Вечный</b>
<!-- ENDIF -->
</td>
</tr>
<!-- ELSEIF postrow.attach.tor_reged.TOR_SILVER_GOLD == 1 -->
<tr class="row4">
<th colspan="3" class="row7"><img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" /> {L_GOLD_STATUS} <img src="images/tor_gold.gif" width="16" height="15" title="{L_GOLD}" /></th>
</tr>
<tr class="row4" align="center">
<td colspan=2>
<tr class="row4" align="center">
<td colspan=3>
<!-- IF postrow.attach.tor_reged.TOR_TIME > 0 -->
<b>Осталось: <span id="change"><span id="day"></span><span id="hour"></span><span id="min"></span><span id="sec"></span></span></b><script language=JavaScript>fulltime();</script> [ {postrow.attach.tor_reged.TOR_TIME_SET1} ]
<!-- ELSE -->
<b>Вечный</b>
<!-- ENDIF -->
</td>
</tr>
<!-- ENDIF -->
#
#-----[ FIND ]------------------------------------------
#
<select name="tor_action" id="tor-select-{postrow.attach.tor_reged.ATTACH_ID}" onchange="$('#tor-confirm-{postrow.attach.tor_reged.ATTACH_ID}').attr('checked', 0); $('#tor-submit-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 1)">
#
#-----[ REPLASE TO ]------------------------------------------
#
<select name="tor_action" id="tor-select-{postrow.attach.tor_reged.ATTACH_ID}" onchange="$('#tor-confirm-{postrow.attach.tor_reged.ATTACH_ID}').attr('checked', 0); $('#tor-submit-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 1); change_status($(this).val(), 0);">
#
#-----[ FIND ]------------------------------------------
#
<option value="set_silver">{L_SET_SILVER_TORRENT}</option>
<!-- ENDIF -->
<!-- ENDIF -->
</select>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<input type="radio" name="status" value="1" id="set_on-{postrow.attach.tor_reged.ATTACH_ID}" onchange="change_status($('#tor-select-{postrow.attach.tor_reged.ATTACH_ID}').val(), 1);" disabled />
Set on: <select name=plastdate id="plastdate-{postrow.attach.tor_reged.ATTACH_ID}" disabled>
<option value=1h> Один час</option>
<option value=2h> Два часа</option>
<option value=3h> Три часа</option>
<option value=5h> Пять часов</option>
<option value=10h> Десять часов</option>
<option value=1d> Один день</option>
<option value=2d> Два дня</option>
<option value=3d> Три дня</option>
<option value=5d> Пять дней</option>
<option value=10d> Десять дней</option>
<option value=1m> Один месяц</option>
<option value=2m> Два месяца</option>
<option value=3m> Три месяца</option>
<option value=1y> Один год</option>
<option style="Font-weight: bold;" value=inf>Вечный</option>
</select>
<input type="radio" name="status" value="2" id="set_po-{postrow.attach.tor_reged.ATTACH_ID}" onchange="change_status($('#tor-select-{postrow.attach.tor_reged.ATTACH_ID}').val(), 2);") disabled />
Set po:
<input type="text" name="set_po_inp" id="set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}" disabled /> <img src="images/date.png" id="cal_btn-{postrow.attach.tor_reged.ATTACH_ID}" align="absmiddle" />
<script type="text/javascript">
var cal = Calendar.setup({
onSelect: function(cal) { cal.hide() }
});
cal.manageFields("cal_btn-{postrow.attach.tor_reged.ATTACH_ID}", "set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}", "%d.%m.%Y %H:%M:%S");
</script>
#
#-----[ FIND ]------------------------------------------
#
<input name="" id="tor-submit-{postrow.attach.tor_reged.ATTACH_ID}" type="submit" value="{L_DO_SUBMIT}" class="liteoption" style="width: 110px;" disabled="disabled" />
#
#-----[ AFTER, ADD ]------------------------------------------
#
<script type="text/javascript">
$('#tor-select-{postrow.attach.tor_reged.ATTACH_ID}').val('');
change_status(1, 0);
function change_status(param, value)
{
var param = param;
var value = value;
if (param == 'set_gold' || param == 'set_silver')
{
switch (value)
{
case 0:
$('#set_po-{postrow.attach.tor_reged.ATTACH_ID}').removeAttr('disabled');
$('#set_on-{postrow.attach.tor_reged.ATTACH_ID}').removeAttr('disabled');
$('#set_po-{postrow.attach.tor_reged.ATTACH_ID}').removeAttr('checked');
$('#set_on-{postrow.attach.tor_reged.ATTACH_ID}').removeAttr('checked');
break;
case 1:
$('#plastdate-{postrow.attach.tor_reged.ATTACH_ID}').removeAttr('disabled');
$('#set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');
break;
case 2:
$('#set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}').removeAttr('disabled');
$('#plastdate-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');
break;
}
}
else
{
$('#set_po-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');
$('#set_on-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');$('#set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');$('#plastdate-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');
$('#plastdate-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');$('#set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');$('#plastdate-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');
$('#set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');$('#set_po_inp-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');$('#plastdate-{postrow.attach.tor_reged.ATTACH_ID}').attr('disabled', 'disabled');
}
}
</script>
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_torrent.php
#
#-----[ FIND ]------------------------------------------
#
// Set gold/silver type for torrent
function change_tor_type ($attach_id, $tor_status_gold)
{
...
}
#
#-----[ REPLASE TO ]------------------------------------------
#
// Set gold/silver type for torrent
function change_tor_type ($attach_id, $tor_status_gold, $time=0)
{
global $db, $topic_id;
if (!$torrent = get_torrent_info($attach_id))
{
bb_die('Torrent not found');
}
if (!(IS_MOD || IS_ADMIN))
{
bb_die($lang['Only_for_mod']);
}
$topic_id = $torrent['topic_id'];
$tor_status_gold = intval($tor_status_gold);
$time = (int) $time;
$db->query("UPDATE ". BT_TORRENTS_TABLE ." SET tor_type = $tor_status_gold, tor_type_time = $time WHERE topic_id = $topic_id LIMIT 1");
}
#
#-----[ OPEN ]------------------------------------------
#
torrent.php
#
#-----[ FIND ]------------------------------------------
#
if (!empty($_POST['tor_action']) && $confirm)
{
....
}
#
#-----[ REPLASE TO ]------------------------------------------
#
if (!empty($_POST['tor_action']) && $confirm)
{
// Delete torrent
if ($_POST['tor_action'] === 'del_torrent')
{
delete_torrent($attach_id, 'request');
redirect("viewtopic.$phpEx?t=$topic_id");
}
// Delete torrent and move topic
if ($_POST['tor_action'] === 'del_torrent_move_topic')
{
delete_torrent($attach_id, 'request');
redirect("modcp.$phpEx?t=$topic_id&mode=move&sid={$userdata['session_id']}");
}
// Set/UnSet GOLD & SILVER
if ( $_POST['tor_action'] == 'set_silver' || $_POST['tor_action'] == 'set_gold')
{
if($_POST['tor_action'] == 'set_silver' || $_POST['tor_action'] == 'set_gold')
$status =isset($_POST['status']) ? (int)$_POST['status'] : 0;
if($status == 1 && isset($_POST['plastdate']))
{
switch($_POST['plastdate'])
{
case "1h":
$time = time() + 60*60;
break;
case "2h":
$time = time() + 60*60*2;
break;
case "3h":
$time = time() + 60*60*3;
break;
case "5h":
$time = time() + 60*60*5;
break;
case "10h":
$time = time() + 60*60*10;
break;
case "1d":
$time = time() + 60*60*24;
break;
case "2d":
$time = time() + 60*60*24*2;
break;
case "3d":
$time = time() + 60*60*24*3;
break;
case "5d":
$time = time() + 60*60*24*5;
break;
case "10d":
$time = time() + 60*60*24*10;
break;
case "1m":
$time = time() + 60*60*24*30;
break;
case "2m":
$time = time() + 60*60*24*30*2;
break;
case "3m":
$time = time() + 60*60*24*30*3;
break;
case "1y":
$time = time() + 60*60*24*365;
break;
case "inf":
$time = -1;
break;
default: $time=0;
}
}
else if(isset($_POST['set_po_inp']) && $status == 2)
{
$time_massiv = explode(" ", $_POST['set_po_inp']);
if(!empty($time_massiv[0])) $time_tmp1 = explode(".", $time_massiv[0]); else message_die(GENERAL_MESSAGE, "Ошибка при вводе даты (dmY)");
if(!empty($time_massiv[1])) $time_tmp2 = explode(":", $time_massiv[1]); else message_die(GENERAL_MESSAGE, "Ошибка при вводе даты (Hi)");
if(!$time = mktime($time_tmp2[0], $time_tmp2[1], 0, $time_tmp1[1], $time_tmp1[0], $time_tmp1[2])) message_die(GENERAL_MESSAGE, "Ошибка при вводе даты (mk)");
}
else $time = 0;
if(!$time) message_die(GENERAL_MESSAGE, "Необходимо ввести дату до нажатия кнопки");
if(time() > $time && $time != -1) message_die(GENERAL_MESSAGE, "Введенная дата не может быть меньше текущей");
if ($_POST['tor_action'] === 'set_silver')
{
$tor_type = TOR_TYPE_SILVER;
}
elseif ($_POST['tor_action'] === 'set_gold')
{
$tor_type = TOR_TYPE_GOLD;
}
change_tor_type($attach_id, $tor_type, $time);
redirect("viewtopic.$phpEx?t=$topic_id");
}
if($_POST['tor_action'] == 'unset_silver_gold' && $bb_cfg['gold_silver_enabled'])
{
$tor_type = 0;
change_tor_type($attach_id, $tor_type);
redirect("viewtopic.$phpEx?t=$topic_id");
}
}
#
#-----[ OPEN ]------------------------------------------
#
attach_mod/displaying_torrent.php
#
#-----[ FIND ]------------------------------------------
#
$tor_type = $tor_info['tor_type'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
if($tor_info['tor_type_time']== -1) $tor_type_time = -1;
else $tor_type_time = date('Y-m-d H:i:s',$tor_info['tor_type_time']);
#
#-----[ FIND ]------------------------------------------
#
'TOR_SILVER_GOLD' => $tor_type,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'TOR_TIME' => $tor_type_time,
'TOR_TIME_SET' => create_date('M,d,Y,H:i:s',$tor_info['tor_type_time'], $userdata['user_timezone'], $transl=0),
'TOR_TIME_SET1' => create_date($bb_cfg['post_date_format'], $tor_info['tor_type_time'], $userdata['user_timezone']),
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
// Create date/time from format and timezone
function create_date ($format, $gmepoch, $tz = null, $trans=1)
{
...
}
#
#-----[ REPLASE TO ]------------------------------------------
#
// Create date/time from format and timezone
function create_date ($format, $gmepoch, $tz = null, $trans=1)
{
global $bb_cfg, $lang;
if (is_null($tz))
{
$tz = $bb_cfg['board_timezone'];
}
if (!$format)
{
$format = $bb_cfg['default_dateformat'];
}
$date = gmdate($format, $gmepoch + (3600 * $tz));
if($trans) return ($bb_cfg['translate_dates']) ? strtr($date, $lang['datetime']) : $date;
else return $date;
}
#
#-----[ OPEN ]------------------------------------------
#
templates/default/css/main.css
#
#-----[ В самый конец файл]----------------------------
#
#cd {
font-size: 10pt;
font-weight: bold;
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
# |
|
|
Вернуться к началу
|
|
|
|
|
|
Вы не можете начинать темы Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете голосовать в опросах Вы не можете прикреплять файлы к сообщениям Вы можете скачивать файлы
|
Все материалы сайта представлены только для ознакомления. При копировании материала ссылка на torrentpier-download.ru
обязательна!
sitemap карта форума | Статистика визитов поисковых ботов | Выдача в поисковиках
Powered by phpBB © 2001, 2011 phpBB Group | ©2011-2024 - Воронеж |
|