CREATE TABLE IF NOT EXISTS `bonus` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`cost` decimal(10,1) unsigned NOT NULL DEFAULT '0.0',
`value` bigint(20) unsigned NOT NULL DEFAULT '0',
`descr` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`type` enum('traffic','invite','VIP','other') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'other',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7;INSERT INTO `bonus` (`id`, `title`, `cost`, `value`, `descr`, `type`) VALUES
(1, '1GB Uploaded', '70.0', 1073741824, 'Echanger 70 points pour 1 Go d''upload.', 'traffic'),
(2, '2 GB Uploaded', '100.0', 2147483648, 'Echanger 100 points pour 2 Go d''upload.', 'traffic'),
(3, '5 GB Uploaded', '250.0', 5368709120, 'Echanger 250 points pour 5 Go d''upload.', 'traffic'),
(4, '10 GB Uploaded', '500.0', 10737418240, 'Echanger 500 points pour 10 Go d''upload.', 'traffic'),
(5, 'Invitations', '1000.0', 2, 'Recevez 2 Invitations pour 1000.00 points de seedbonus', 'invite');ALTER TABLE users ADD `seedbonus` decimal(10,1) NOT NULL;ALTER TABLE `users` ADD `vipuntil` datetime NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE `users` ADD `oldclass` int(10) unsigned NOT NULL default '0';Open blocks/login_blocks. PHP and search for:
$privacylevel = T_($CURUSER["privacy"]);Add after:
$bonus = $CURUSER['seedbonus'];Search:
". T_("RATIO") .": $userratio Add after:
<br>seedbonus : <b><a href=mybonus.php>".$bonus."</a></b>Open backend/Cleanup. PHP and look for:
//LOCAL TORRENTS - MAKE NON-ACTIVE/OLD TORRENTS INVISIBLE
$deadtime = gmtime() - $site_config["max_dead_torrent_time"];
SQL_Query_exec("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime) AND seeders = '0' AND leechers = '0' AND external !='yes'");
Add after:
// Seedbonus
$qry = "SELECT DISTINCT userid as peer, (
SELECT DISTINCT COUNT( torrent )
FROM peers
WHERE seeder = 'yes' AND userid = peer) AS count
FROM peers WHERE seeder = 'yes'";
$res = SQL_Query_exec($qry);
while ( $row = mysql_fetch_object($res) )
{
SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . ($site_config["bonuspertime"] * $row->count) . "' WHERE id = '" . $row->peer . "'");
}
// EndOpen backend/config. php and look for:
$site_config['blocks_dir'] = getcwd().'/blocks';Add this:
$site_config["bonuspertime"] = 0.5;Open backend/config. php and look for:
$site_config['blocks_dir'] = getcwd().'/blocks';Add this:
$site_config["bonuspertime"] = 0.5;Open account. PHP and look for:
<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?>
| Add below:
<?php print("<a href='mybonus.php'><b>Mon Seedbonus</b></a>");?>Open your ADMINCP. PHP and look for:
<td colspan="5"> </td>
</tr>
<tr>
<td align="center"><a href="admincp.php?action=privacylevel"><img src="images/admin/privacy_level.png" border="0" width="32" height="32" alt="" /><br />Privacy Level<br /></a></td>
<td align="center"><a href="admincp.php?action=pendinginvite"><img src="images/admin/pending_invited_user.png" border="0" width="32" height="32" alt="" /><br />Pending Invited Users<br /></a></td>
<td align="center"><a href="admincp.php?action=invited"><img src="images/admin/invited_user.png" border="0" width="32" height="32" alt="" /><br />Invited Users<br /></a></td>
<td align="center"><a href="admincp.php?action=sqlerr"><img src="images/admin/sql_error.png" border="0" width="32" height="32" alt="" /><br />SQL Error<br /></a></td>
<td align="center"><a href="admincp.php?action=settings"><img src="images/admin/config.png" border="0" width="32" height="32" alt="" /><br />Configuration<br /></a></td>
</tr>Add to the following:
<td colspan="5"> </td>
</tr>
<tr>
<td align="center"><a href=admincp.php?action=seedbonus><img src="images/admin/seedbonus.png" border=0 width=32 height=32><br>Gestion du Seedbonus</a></td>
</tr>Search:
} // End Forum management Add to the following:
#======================================================================#
# Seedbonus Manager
#======================================================================#
if ($action == "seedbonus" && $do != "change")
{
if (get_user_class() < 7)
show_error_msg("STOP", "Zone réservé aux personnes ayant droit ! et toi tu l'as pas nanana !!!");
if ($do == "del")
{
if (!@count($_POST["ids"])) show_error_msg("Error", "rien sélectionner.", 1);
$ids = array_map("intval", $_POST["ids"]);
$ids = implode(", ", $ids);
SQL_Query_exec("DELETE FROM `bonus` WHERE `id` IN ($ids)");
autolink("admincp.php?action=seedbonus", "entrées supprimées");
}
$count = get_row_count("bonus");
list($pagertop, $pagerbottom, $limit) = pager(25, $count, 'admincp.php?action=seedbonus&');
$res = SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` ORDER BY `type` $limit");
stdhead("Seedbonus Manager");
navmenu();
begin_frame("Gestion du seedbonus");
?>
<center>
Cette page affiche toutes les options disponibles sur le commerce auquel les utilisateurs peuvent échanger leurs seedbonus pour. <?php echo number_format($count); ?> ; <br><br><a href="admincp.php?action=seedbonus&do=change&id=null">Ajouter</a> une nouvelle option?
</center>
<?php if ($count > 0): ?>
<br />
<form id="seedbonus" method="post" action="admincp.php?action=seedbonus">
<input type="hidden" name="do" value="del" />
<table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class="table_table">
<tr>
<th class="table_head">Titre</th>
<th class="table_head">Description</th>
<th class="table_head">Points</th>
<th class="table_head">Valeur</th>
<th class="table_head">Type</th>
<th class="table_head">Editer</th>
<th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
</tr>
<?php while ($row = mysql_fetch_object($res)):
$row->value = ( $row->type == "traffic" ) ? mksize( $row->value ) : ( int ) $row->value;
?>
<tr>
<td class="table_col1" align="center"><?php echo htmlspecialchars($row->title); ?></td>
<td class="table_col2"><?php echo htmlspecialchars($row->descr); ?></td>
<td class="table_col1" align="center"><?php echo $row->cost; ?></td>
<td class="table_col2" align="center"><?php echo $row->value; ?></td>
<td class="table_col1" align="center"><?php echo $row->type; ?></td>
<td class="table_col2" align="center"><a href="admincp.php?action=seedbonus&do=change&id=<?php echo $row->id; ?>">Editer</a></td>
<td class="table_col1" align="center"><input type="checkbox" name="ids[]" value="<?php echo $row->id; ?>" /></td>
</tr>
<?php endwhile; ?>
<tr>
<td colspan="7" align="right">
<input type="submit" value="Supprimer la sélection" />
</td>
</tr>
</table>
</form>
<?php
endif;
if ($count > 25) echo $pagerbottom;
end_frame();
stdfoot();
}
if ($action == "seedbonus" && $do == "change")
{
$row = null;
if ( is_valid_id($_REQUEST['id']) )
{
$res = SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` WHERE `id` = '$_REQUEST[id]'");
$row = mysql_fetch_object($res);
}
if ( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if ( empty($_POST['title']) or empty($_POST['descr']) or empty($_POST['type']) or !is_numeric($_POST['cost']) )
{
autolink($_SERVER['HTTP_REFERER'], "information manquante.");
}
$_POST["value"] = ( $_POST["type"] == "traffic" ) ? strtobytes( $_POST["value"] ) : ( int ) $_POST["value"];
$var = array_map('sqlesc', $_POST);
extract( $var );
if ( $row == null )
{
SQL_Query_exec("INSERT INTO `bonus` (`title`, `descr`, `cost`, `value`, `type`) VALUES ($title, $descr, $cost, $value, $type)");
}
else
{
SQL_Query_exec("UPDATE `bonus` SET `title` = $title, `descr` = $descr, `cost` = $cost, `value` = $value, `type` = $type WHERE `id` = $id");
}
autolink("admincp.php?action=seedbonus", "Mise à jour du seedbonus.");
}
stdhead("Seedbonus Management");
navmenu();
begin_frame("Gestion du seedbonus");
?>
<form method="post" action="admincp.php?action=seedbonus&do=change">
<?php if ($row != null): ?>
<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
<?php endif; ?>
<table border="0" class="table_table" width="90%" cellpadding="3" align="center">
<tr>
<th class="table_head" colspan="2">Gestion du Seedbonus</th>
</tr>
<tr>
<td class="table_col1"><b>Titre:</b></td>
<td class="table_col2"><input type="text" name="title" value="<?php echo ( $row != null ? $row->title : null ); ?>" size="50" /></td>
</tr>
<tr>
<td class="table_col1"><b>Points:</b></td>
<td class="table_col2"><input type="text" name="cost" value="<?php echo ( $row != null ? $row->cost : null ); ?>" size="5" /></td>
</tr>
<tr>
<td class="table_col1"><b>Type:</b></td>
<td class="table_col2">
<select name="type">
<?php foreach (array('invite', 'traffic','VIP', 'other') as $type): ?>
<option value="<?php echo $type; ?>" <?php echo ( $row != null && $row->type == $type ? 'selected="selected"' : null ); ?>><?php echo $type; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td class="table_col1"><b>Valeur:</b></td>
<td class="table_col2"><input type="text" name="value" value="<?php echo ( $row != null ? $row->value : null ); ?>" size="10" /></td>
</tr>
<tr>
<td class="table_col1" valign="top"><b>Description:</b></td>
<td class="table_col2"><textarea name="descr" rows="5" cols="38"><?php echo ( $row != null ? $row->descr : null ); ?></textarea></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="reset" value="Annuler" />
<input type="submit" value="Envoyer" />
</td>
</tr>
</table>
</form>
<?php
end_frame();
stdfoot();
}