mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
r397
сид бонус end небольшой фикс INSERT INTO `bb_config` VALUES ('bonus_upload', ''); INSERT INTO `bb_config` VALUES ('bonus_upload_price', ''); git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@397 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
c252d603dc
commit
a7356b7ce3
12 changed files with 139 additions and 17 deletions
|
@ -580,6 +580,8 @@ INSERT INTO `bb_config` VALUES ('board_email_form', '0');
|
|||
INSERT INTO `bb_config` VALUES ('board_email_sig', 'Thanks, The Management');
|
||||
INSERT INTO `bb_config` VALUES ('board_startdate', '');
|
||||
INSERT INTO `bb_config` VALUES ('board_timezone', '0');
|
||||
INSERT INTO `bb_config` VALUES ('bonus_upload', '');
|
||||
INSERT INTO `bb_config` VALUES ('bonus_upload_price', '');
|
||||
INSERT INTO `bb_config` VALUES ('birthday_enabled', '1');
|
||||
INSERT INTO `bb_config` VALUES ('birthday_max_age', '99');
|
||||
INSERT INTO `bb_config` VALUES ('birthday_min_age', '10');
|
||||
|
|
|
@ -51,6 +51,7 @@ else
|
|||
if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name])
|
||||
{
|
||||
if($config_name == 'seed_bonus_points' || $config_name == 'seed_bonus_release') $new[$config_name] = serialize($new[$config_name]);
|
||||
if($config_name == 'bonus_upload' || $config_name == 'bonus_upload_price') $new[$config_name] = serialize($new[$config_name]);
|
||||
|
||||
bb_update_config(array($config_name => $new[$config_name]));
|
||||
}
|
||||
|
@ -119,6 +120,22 @@ switch($mode)
|
|||
'POINTS' => $row,
|
||||
));
|
||||
}
}
|
||||
|
||||
if($new['bonus_upload'] && $new['bonus_upload_price'])
|
||||
{
|
||||
$upload_row = unserialize($new['bonus_upload']);
|
||||
$price_row = unserialize($new['bonus_upload_price']);
|
||||
|
||||
foreach($upload_row as $i => $row)
|
||||
{
|
||||
if(!$row || !$price_row[$i]) continue;
|
||||
|
||||
$template->assign_block_vars('bonus_upload', array(
|
||||
'UP' => $upload_row[$i],
|
||||
'PRICE' => $row,
|
||||
));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -32,7 +32,7 @@ require(INC_DIR .'functions_admin_torrent.php');
|
|||
require(INC_DIR .'functions_admin_cron.php');
|
||||
|
||||
|
||||
$sql = DB()->fetch_rowset("SELECT * FROM " . BB_CONFIG);
|
||||
$sql = DB()->fetch_rowset("SELECT * FROM ". BB_CONFIG ." WHERE config_name = 'cron_enabled' OR config_name = 'cron_check_interval'");
|
||||
|
||||
foreach($sql as $row)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ if (isset($this->request['post_id']))
|
|||
}
|
||||
elseif (isset($this->request['topic_id']))
|
||||
{
|
||||
$post_id = (int) $this->request['post_id'];
|
||||
$topic_id = (int) $this->request['topic_id'];
|
||||
$post = DB()->fetch_row("SELECT t.*, f.*
|
||||
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f
|
||||
WHERE t.topic_id = $topic_id
|
||||
|
@ -62,7 +62,7 @@ switch($this->request['type'])
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->ajax_die(sprintf($lang['SORRY_AUTH_DELETE'], strip_tags($is_auth['auth_delete_type'])));
|
||||
$this->ajax_die(sprintf($lang['DELETE_OWN_POSTS'], strip_tags($is_auth['auth_delete_type'])));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -113,6 +113,10 @@ switch($this->request['type'])
|
|||
|
||||
case 'edit':
|
||||
case 'editor':
|
||||
if ($post['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'])
|
||||
{
|
||||
$this->ajax_die($lang['EDIT_OWN_POSTS']);
|
||||
}
|
||||
if((mb_strlen($post['post_text'], 'UTF-8') > 1000) || $post['post_attachment'] || ($post['topic_first_post_id'] == $post_id))
|
||||
{
|
||||
$this->response['redirect'] = make_url('posting.php?mode=editpost&p='. $post_id);
|
||||
|
@ -213,9 +217,6 @@ switch($this->request['type'])
|
|||
$this->ajax_die('empty topic_id');
|
||||
}
|
||||
|
||||
if(!$t_data) $this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
|
||||
|
||||
$is_auth = auth(AUTH_ALL, $t_data['forum_id'], $userdata, $t_data);
|
||||
if(bf($userdata['user_opt'], 'user_opt', 'allow_post'))
|
||||
{
|
||||
$this->ajax_die($lang['RULES_REPLY_CANNOT']);
|
||||
|
|
|
@ -52,7 +52,7 @@ $bb_cfg = $tr_cfg = $page_cfg = array();
|
|||
|
||||
// Increase number of revision after update
|
||||
$bb_cfg['tp_version'] = '2.4 (RC)';
|
||||
$bb_cfg['tp_release_state'] = 'R396';
|
||||
$bb_cfg['tp_release_state'] = 'R397';
|
||||
$bb_cfg['tp_release_date'] = '13-04-2012';
|
||||
|
||||
// Database
|
||||
|
|
|
@ -220,14 +220,14 @@ if($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['see
|
|||
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
||||
|
||||
DB()->query("
|
||||
UPDATE ". BB_USERS ." u
|
||||
LEFT JOIN ". BB_BT_USERS ." bu ON(bu.user_id = u.user_id)
|
||||
LEFT JOIN tmp_bonus b ON(b.user_id = u.user_id)
|
||||
SET
|
||||
u.user_points = u.user_points + $user_points,
|
||||
bu.points_today = bu.points_today + $user_points,
|
||||
b.user_id = 0
|
||||
WHERE u.user_id = b.user_id
|
||||
UPDATE ". BB_USERS ." u, ". BB_BT_USERS ." bu, tmp_bonus b
|
||||
SET
|
||||
u.user_points = u.user_points + $user_points,
|
||||
bu.points_today = bu.points_today + $user_points,
|
||||
b.user_id = 0
|
||||
WHERE
|
||||
b.user_id = u.user_id
|
||||
AND bu.user_id = u.user_id
|
||||
AND b.release_count <= $release
|
||||
AND u.user_regdate < $user_regdate
|
||||
AND u.user_active = 1
|
||||
|
|
|
@ -2,4 +2,70 @@
|
|||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
if($bb_cfg['seed_bonus_enabled'] || !$bb_cfg['seed_bonus_enabled']) bb_die($lang['MODULE_OFF']);
|
||||
$user_id = $userdata['user_id'];
|
||||
$user_points = $userdata['user_points'];
|
||||
|
||||
if($bb_cfg['bonus_upload'] && $bb_cfg['bonus_upload_price'])
|
||||
{
|
||||
$upload_row = unserialize($bb_cfg['bonus_upload']);
|
||||
$price_row = unserialize($bb_cfg['bonus_upload_price']);
|
||||
}
|
||||
else bb_die($lang['EXCHANGE_NOT']);
|
||||
|
||||
if (isset($_POST['bonus_id']))
|
||||
{
|
||||
$id = (int) $_POST['bonus_id'];
|
||||
|
||||
$btu = get_bt_userdata($user_id);
|
||||
|
||||
if (empty($btu))
|
||||
{
|
||||
require(INC_DIR .'functions_torrent.php');
|
||||
generate_passkey($user_id, true);
|
||||
$btu = get_bt_userdata($user_id);
|
||||
}
|
||||
|
||||
if(empty($upload_row[$id]) || empty($price_row[$id]))
|
||||
{
|
||||
bb_die('false');
|
||||
}
|
||||
|
||||
$upload = $upload_row[$id]*1024*1024*1024;
|
||||
$points = $price_row[$id];
|
||||
|
||||
if($userdata['user_points'] <= $points) bb_die('false2');
|
||||
|
||||
DB()->query("UPDATE ". BB_BT_USERS ." bu, ". BB_USERS ." u
|
||||
SET
|
||||
bu.u_up_total = u_up_total + $upload,
|
||||
u.user_points = u.user_points - $points
|
||||
WHERE
|
||||
bu.user_id = $user_id
|
||||
AND u.user_id = bu.user_id
|
||||
");
|
||||
|
||||
cache_rm_user_sessions ($user_id);
|
||||
|
||||
bb_die(sprintf($lang['BONUS_SUCCES'], $_POST['bonus_id']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'U_USER_PROFILE' => PROFILE_URL . $user_id,
|
||||
'S_MODE_ACTION' => 'profile.php?mode=bonus',
|
||||
));
|
||||
|
||||
foreach($price_row as $i => $price)
|
||||
{
|
||||
if(!$price || !$upload_row[$i]) continue;
|
||||
$class = ($user_points >= $price) ? 'seed' : 'leech';
|
||||
|
||||
$template->assign_block_vars('bonus_upload', array(
|
||||
'ID' => $i,
|
||||
'DESC' => sprintf($lang['BONUS_UPLOAD_DESC'], humn_size($upload_row[$i]*1024*1024*1024)),
|
||||
'PRICE' => sprintf($lang['BONUS_UPLOAD_PRICE'], sprintf('%.2f', $price), $class, $user_points),
|
||||
));
|
||||
}
|
||||
|
||||
print_page('usercp_bonus.tpl');
|
||||
}
|
|
@ -677,4 +677,4 @@ $lang['SEED_BONUS_POINTS'] = 'bonuses in an hour';
|
|||
$lang['SEED_BONUS_TOR_SIZE'] = '<h4>Minimum distribution for which will be awarded bonuses </h4> <h6> If you want to calculate bonuses for all distribution, leave blank. </h6>';
|
||||
$lang['SEED_BONUS_USER_REGDATA'] = '<h4>Minimum length of user tracker, after which will be awarded bonuses </h4> <h6> If you want to accrue bonuses to all users, leave blank. </h6>';
|
||||
$lang['SEED_BONUS_WARNING'] = 'ATTENTION! Seed Bonuses should be in ascending order';
|
||||
|
||||
$lang['SEED_BONUS_ROPORTION'] = 'Proportion addition for an exchange of bonuses on GB';
|
||||
|
|
|
@ -1363,6 +1363,11 @@ $lang['RELEASED'] = 'Released';
|
|||
$lang['BONUS'] = 'On the rare';
|
||||
$lang['SEED_BONUS'] = 'Seed Bonus';
|
||||
$lang['EXCHANGE'] = 'Exchange';
|
||||
$lang['BONUS_UPLOAD_DESC'] = '<b>%s to distribution</b> <br /> To exchange bonus points on %1$s traffic which will be added on to the sum of your distribution.';
|
||||
$lang['BONUS_UPLOAD_PRICE'] = '<b>%s</b> (at You <b class="%s">%s</b>)';
|
||||
$lang['PRICE'] = 'price';
|
||||
$lang['EXCHANGE_NOT'] 'The exchange not available';
|
||||
$lang['BONUS_SUCCES'] = 'To you it is successfully enlisted %s GB';
|
||||
$lang['IT_WILL_BE_DOWN'] = 'it will start to be considered after it will be downloaded';
|
||||
$lang['SPMODE_FULL'] = 'Show peers in full details';
|
||||
|
||||
|
|
|
@ -675,4 +675,5 @@ $lang['SEED_BONUS_POINTS'] = 'бонусов в час';
|
|||
$lang['SEED_BONUS_TOR_SIZE'] = '<h4>Минимальный размер раздачи, за который будут начисляться бонусы</h4><h6>Если хотите начислять бонусы за все раздачи, оставьте поле пустым.</h6>';
|
||||
$lang['SEED_BONUS_USER_REGDATA'] = '<h4>Минимальный стаж пользователя на трекере, после которого будут начисляться бонусы</h4><h6>Если хотите начислять бонусы всем пользователям, оставьте поле пустым.</h6>';
|
||||
$lang['SEED_BONUS_WARNING'] = 'ВНИМАНИЕ! Сид Бонусы должны быть в порядке возрастания';
|
||||
$lang['SEED_BONUS_ROPORTION'] = 'Добавление пропорции для обмена бонусов на GB';
|
||||
|
||||
|
|
|
@ -1369,6 +1369,11 @@ $lang['RELEASED'] = 'На своих';
|
|||
$lang['BONUS'] = 'На редких';
|
||||
$lang['SEED_BONUS'] = 'СидБонус';
|
||||
$lang['EXCHANGE'] = 'Обменять';
|
||||
$lang['BONUS_UPLOAD_DESC'] = '<b>%s к раздаче</b> <br /> Обменять бонусные очки на %1$s трафика, который будет приплюсован к сумме Вашей раздачи.';
|
||||
$lang['BONUS_UPLOAD_PRICE'] = '<b>%s</b> (у Вас <b class="%s">%s</b>)';
|
||||
$lang['PRICE'] = 'Цена';
|
||||
$lang['EXCHANGE_NOT'] = 'Обмен не доступен';
|
||||
$lang['BONUS_SUCCES'] = 'Вам успешно зачислено %s GB';
|
||||
$lang['IT_WILL_BE_DOWN'] = 'начнет учитываться после того как будет скачано';
|
||||
$lang['SPMODE_FULL'] = 'Подробная статистика пиров';
|
||||
|
||||
|
|
|
@ -475,6 +475,31 @@
|
|||
<td>{L_SEED_BONUS_USER_REGDATA}</td>
|
||||
<td><input class="post" type="text" size="25" maxlength="100" name="seed_bonus_user_regdate" value="{SEED_BONUS_USER_REGDATE}" /> {L_DAYS}</td>
|
||||
</tr>
|
||||
<tr class="row3 med">
|
||||
<td class="bold tCenter" colspan="2">Настройка обмена бонусов</td>
|
||||
</tr>
|
||||
<!-- BEGIN bonus_upload -->
|
||||
<tr id="bonus_upload_{bonus_upload.UP}">
|
||||
<td><h4>{L_SEED_BONUS_ROPORTION}</h4><h6></h6></td>
|
||||
<td>
|
||||
<input class="post" type="text" size="5" name="bonus_upload[]" value="{bonus_upload.UP}" /> размер в GB <br />
|
||||
<input class="post" type="text" size="5" name="bonus_upload_price[]" value="{bonus_upload.PRICE}" /> их цена
|
||||
<input onclick="$('#bonus_upload_{bonus_upload.UP}').remove();" class="post" type="button" size="2" value="{L_DELETE}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END bonus -->
|
||||
<tr class="row3 med"><td colspan="2"></td></tr>
|
||||
<tr id="bonus_upload">
|
||||
<td><h4>{L_SEED_BONUS_ROPORTION}</h4><h6></h6></td>
|
||||
<td>
|
||||
<input class="post" type="text" size="5" name="bonus_upload[]" value="" /> размер в GB <br />
|
||||
<input class="post" type="text" size="5" name="bonus_upload_price[]" value="" /> их цена
|
||||
<input onclick="$('#bonus_upload').clone().appendTo('.bonus_upload');" class="post" type="button" size="2" value="+" />
|
||||
<input onclick="$('#bonus_upload').remove();" class="post" type="button" size="2" value="-" />
|
||||
</td>
|
||||
</tr>
|
||||
<tbody class="bonus_upload"></tbody>
|
||||
<tr class="row3 med"><td colspan="2"></td></tr>
|
||||
<!-- ENDIF / CONFIG_MODS -->
|
||||
<tr>
|
||||
<td class="catBottom" colspan="2">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue