message
This commit is contained in:
36
system/modules/torrent/list.php
Normal file
36
system/modules/torrent/list.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?
|
||||
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
|
||||
|
||||
$limit = intval( $config['torrent_number'] );
|
||||
$count_all = $db->super_query("SELECT COUNT(*) as count FROM ".PREFIX."_torrents as torrents, ".PREFIX."_post as post WHERE torrents.news_id=post.id AND post.approve=1");
|
||||
$posts = $count_all['count'];
|
||||
|
||||
if($posts){
|
||||
|
||||
$page = intval( $_REQUEST['cstart'] );
|
||||
$total = intval( ( ( $posts - 1 ) / $limit ) + 1 );
|
||||
if( $page <= 0 ) $page = 1;
|
||||
if( $page > $total ) $page = $total;
|
||||
$start = $page * $limit - $limit;
|
||||
$i = $start;
|
||||
|
||||
$result = $db->query("SELECT torrents.news_id, torrents.ctime, torrents.leechers, torrents.seeders, torrents.completed, torrents.size, post.category, post.alt_name, post.title FROM ".PREFIX."_torrents as torrents, ".PREFIX."_post as post WHERE torrents.news_id=post.id AND post.approve=1 ORDER BY post.date DESC LIMIT " . $start . "," . $limit);
|
||||
while($row = $db->get_row($result)){
|
||||
$i ++;
|
||||
$cat = "<a href=\"" . $config['http_home_url'] . get_url($row['category']) . "/\">".$cat_info[$row['category']]['name']."</a>";
|
||||
$news_link = "<a href='/".$row['news_id']."-".$row['alt_name'].".html'>".$row['title']."</a>";
|
||||
|
||||
$top_table .= "<tr><td>$cat</td><td align=\"center\">$news_link</td><td style=\"color:#F55;\" align=\"center\">".$row['seeders']."</td><td style=\"color:#1FA800;\" align=\"center\">".$row['leechers']."</td><td style=\"color:#5579FF;\" align=\"center\">".$row['completed']."</td><td align=\"center\">".mksize($row['size'])."</td><td align=\"center\">".date("j.m.Y", $row['ctime'])."</td></tr>";
|
||||
}
|
||||
$tpl->load_template('tracker.tpl');
|
||||
$tpl->set('{list}', $top_table);
|
||||
$tpl->compile( 'content' );
|
||||
$tpl->clear();
|
||||
|
||||
$nav = "/tracker/page/{page}";
|
||||
CreateNavigation( $nav, $page, $total );
|
||||
$db->free($result);
|
||||
} else {
|
||||
msgbox("Îøèáêà", "Çàãðóæåííûå òîððåíòû îòñóòâóþò");
|
||||
}
|
||||
?>
|
||||
64
system/modules/torrent/upload.php
Normal file
64
system/modules/torrent/upload.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?
|
||||
if( ! defined( 'DATALIFEENGINE' ) ) {die( "Hacking attempt!" );}
|
||||
if (@ini_get( 'safe_mode' ) == 1)define( 'FOLDER_PREFIX', "" ); else define( 'FOLDER_PREFIX', date( "Y-m" ) );
|
||||
|
||||
$idpost = $row['id'];
|
||||
$file_prefix = time() + rand( 1, 100 );
|
||||
$file_prefix .= "_";
|
||||
$file_prefix = FOLDER_PREFIX.'/'.$file_prefix;
|
||||
|
||||
$current_image = 'tor_add';
|
||||
$image = $_FILES[$current_image]['tmp_name'];
|
||||
$image_name = $_FILES[$current_image]['name'];
|
||||
$image_size = $_FILES[$current_image]['size'];
|
||||
$error_code = $_FILES[$current_image]['error'];
|
||||
|
||||
$img_name_arr = explode( ".", $image_name );
|
||||
$type = totranslit( end( $img_name_arr ) );
|
||||
if( $image_name != "" ) {
|
||||
$curr_key = key( $img_name_arr );
|
||||
unset( $img_name_arr[$curr_key] );
|
||||
$image_name = totranslit( implode( ".", $img_name_arr ) ) . "." . $type;
|
||||
}
|
||||
if(substr($image_name, -8) == ".torrent") {
|
||||
if( ! is_dir( ROOT_DIR . "/uploads/torrents/" . FOLDER_PREFIX ) ){
|
||||
mkdir( ROOT_DIR . "/uploads/torrents/" . FOLDER_PREFIX, 0777 );
|
||||
chmod( ROOT_DIR . "/uploads/torrents/" . FOLDER_PREFIX, 0777 );
|
||||
}
|
||||
|
||||
@move_uploaded_file( $image, ROOT_DIR . "/uploads/torrents/" . $file_prefix . $image_name );
|
||||
|
||||
if( @file_exists( ROOT_DIR . "/uploads/torrents/" . $file_prefix . $image_name ) ) {
|
||||
if( intval( $config['max_file_size'] ) and @filesize( ROOT_DIR . "/uploads/torrents/" . $file_prefix . $image_name ) > ($config['max_file_size'] * 1024) ) {
|
||||
@unlink( ROOT_DIR . "/uploads/torrents/" . $file_prefix . $image_name );
|
||||
} else {
|
||||
@chmod( ROOT_DIR . "/uploads/torrents/" . $file_prefix . $image_name, 0666 );
|
||||
|
||||
//********* Tracker by MSW *** start *********//
|
||||
require_once( ROOT_DIR."/system/classes/torrent.class.php" );
|
||||
$tr_file = ROOT_DIR."/uploads/torrents/".$file_prefix.$image_name;
|
||||
|
||||
$torrent = new Torrent($tr_file);
|
||||
if($error = $torrent->errors()){
|
||||
|
||||
}else{
|
||||
$files_size = $torrent->size();
|
||||
$hash = $torrent->hash_info();
|
||||
|
||||
$e_hash = addslashes(pack("H*", $hash));
|
||||
$tr_fild = ", info_hash, size, ctime";
|
||||
$tr_info = ", '{$e_hash}', '{$files_size}', '".time()."'";
|
||||
//********* Tracker by MSW *** stop *********//
|
||||
$db->query( "INSERT INTO " . PREFIX . "_torrents (news_id, name, onserver, author {$tr_fild}) values ('{$row['id']}', '$image_name', '{$file_prefix}{$image_name}', '{$member_id[name]}' {$tr_info})" );
|
||||
|
||||
$id_upfile = $db->insert_id();
|
||||
$full_story .= "<br />[torrent=$id_upfile]";
|
||||
$db->query( "UPDATE " . PREFIX . "_post SET full_story='$full_story' where id = '$idpost'" );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user