Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=117)
-   -   [TSSE 5.x] Genre MOD (http://www.bvlist.com/showthread.php?t=2846)


And replace with:
Code:


Find:
Code:

$torrents['name'] = htmlspecialchars_uni($torrents['name']);
And add after that:
Code:

$torrents['genre'] = htmlspecialchars_uni($torrents['genre']);
  $genre = $torrents['genre'];

Find:
Code:

$torrent_download_link = (!$is_bookmark_page ? '' : '');
And add after that:
Code:

$genre = $torrents['genre'];
Find:
Code:

$query = sql_query("SELECT ".($torrentspeed == 'yes' ? '(t.size * t.times_completed + SUM(p.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(t.added)) AS totalspeed,' : '')." t.*, c.id as categoryid, c.image, c.name as categoryname, u.username, g.namestyle {$from} LEFT JOIN categories c ON (t.category=c.id) LEFT JOIN users u ON (t.owner=u.id) LEFT JOIN usergroups g ON (u.usergroup=g.gid) ".($torrentspeed == 'yes' ? 'LEFT JOIN peers p ON (t.id=p.torrent)' : '')." WHERE ".($showvisible ? "t.visible = 'yes' AND " : "")."t.banned = 'no'".(isset($extraqueries) ? $extraqueries : '')." {$groupby}{$orderbyvalue} $limit") or sqlerr(__FILE__,__LINE__);
And replace with:
Code:

$query = sql_query("SELECT ".($torrentspeed == 'yes' ? '(t.genre, t.size * t.times_completed + SUM(p.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(t.added)) AS totalspeed,' : '')." t.*, c.id as categoryid, c.image, c.name as categoryname, u.username, g.namestyle {$from} LEFT JOIN categories c ON (t.category=c.id) LEFT JOIN users u ON (t.owner=u.id) LEFT JOIN usergroups g ON (u.usergroup=g.gid) ".($torrentspeed == 'yes' ? 'LEFT JOIN peers p ON (t.id=p.torrent)' : '')." WHERE ".($showvisible ? "t.visible = 'yes' AND " : "")."t.banned = 'no'".(isset($extraqueries) ? $extraqueries : '')." {$groupby}{$orderbyvalue} $limit") or sqlerr(__FILE__,__LINE__);
In upload.php:
Find:
Code:

$postoptions = array(
                                  '1'                            =>''.$info.'',
                                  '2'                            =>          '',
                                  '3'                            =>          ''.$lang->upload['field5'],
                                  '4'                            =>'
                                 

                                                 
                                 

                                 
                                  '.$lang->upload['atypes'],
                                  '5'                            =>'',
                                  '6'                            =>          $showcategories,
                                  '7'                            =>          ' '.$lang->upload['field20'],
                                  '8'                            =>          $offer,
                                  '9'                            =>          ' '.$lang->upload['field12'],
                                  '10'                        =>          $fb,
                                  '11'        =>$rb,
                                  '12'        =>          $sb,
                                  '13'        =>          ' '.$lang->upload['field16'],
                                  '14'        =>          ' '.$lang->upload['scene2']

And replace with:
Code:

$postoptions = array(
                                  '1'                            =>''.$info.'',
                                  '2'                            =>          '',
                                  '3'                            =>          ''.$lang->upload['field5'],
                                  '4'                            =>'
                                 

                                                 
                                 

                                 
                                  '.$lang->upload['atypes'],
                                  '5'                            =>'',
                                  '6'                            =>          $showcategories,
                                  '7'                            =>          $genre,
                                  '8'                            =>          ' '.$lang->upload['field20'],
                                  '9'                            =>          $offer,
                                  '10'                        =>          ' '.$lang->upload['field12'],
                                  '11'                        =>          $fb,
                                  '12'        =>$rb,
                                  '13'        =>          $sb,
                                  '14'        =>          ' '.$lang->upload['field16'],
                                  '15'        =>          ' '.$lang->upload['scene2']

Find:
Code:

require_once(INC_PATH.'/functions_category.php');
                  $showcategories = ts_category_list('type',intval($_GET['type']));

And add after that:
Code:

$genre = '  <= REQUIRED!   
   
  /
 
  <=  (optional)';

(you can edit those line according your needs…)

Find:
Code:

$postoptionstitle = array(
                                  '1'                            => $lang->upload['field0'],
                                  '2'                            =>          $lang->upload['field1'],
                                  '3'                            =>          $lang->upload['field4'],
                                  '4'                            =>          $lang->upload['field21'],
                                  '5'                            =>          $lang->upload['field22'],
                                  '6'                            =>          $lang->upload['field8'],
                                  '7'                            =>          $lang->upload['field19'],
                                  '8'                            =>          $o,
                                  '9'                            =>          $lang->upload['anonymous'],
                                  '10'        =>          $fa,
                                  '11'        =>$ra,
                                  '12'        =>          $sa,
                                  '13'        =>          $lang->upload['field15'],
                                  '14'        => $lang->upload['scene'],

And modify to:
Code:

$postoptionstitle = array(
                                  '1'                            =>  $lang->upload['field0'],
                                  '2'                            =>          $lang->upload['field1'],
                                  '3'                            =>          $lang->upload['field4'],
                                  '4'                            =>          $lang->upload['field21'],
                                  '5'                            =>          $lang->upload['field22'],
                                  '6'                            =>          $lang->upload['field8'],
                                  '7'                            =>  $lang->upload['genre'],
                                  '8'                            =>          $lang->upload['field19'],
                                  '9'                            =>          $o,
                                  '10'        =>          $lang->upload['anonymous'],
                                  '11'        =>          $fa,
                                  '12'        =>  $ra,
                                  '13'        =>          $sa,
                                  '14'        =>          $lang->upload['field15'],
                                  '15'        =>  $lang->upload['scene'],

Find:
Code:

$postoptions = array(
                                  '1'                            =>''.$info.'',
                                  '2'                            =>          '',
                                  '3'                            =>          ''.$lang->upload['field5'],
                                  '4'                            =>'
                                 

                                                 
                                 

                                 
                                  '.$lang->upload['atypes'],
                                  '5'                            =>'',
                                  '6'                            =>          $showcategories,
                                  '7'                            =>          ' '.$lang->upload['field20'],
                                  '8'                            =>          $offer,
                                  '9'                            =>          ' '.$lang->upload['field12'],
                                  '10'                        =>          $fb,
                                  '11'        =>$rb,
                                  '12'        =>          $sb,
                                  '13'        =>          ' '.$lang->upload['field16'],
                                  '14'        =>          ' '.$lang->upload['scene2']

And replace to:
Code:

$postoptions = array(
                                  '1'                            =>''.$info.'',
                                  '2'                            =>          '',
                                  '3'                            =>          ''.$lang->upload['field5'],
                                  '4'                            =>'
                                 

                                                 
                                 

                                 
                                  '.$lang->upload['atypes'],
                                  '5'                            =>'',
                                  '6'                            =>          $showcategories,
                                  '7'                            =>          $genre,
                                  '8'                            =>          ' '.$lang->upload['field20'],
                                  '9'                            =>          $offer,
                                  '10'                        =>          ' '.$lang->upload['field12'],
                                  '11'                        =>          $fb,
                                  '12'        =>$rb,
                                  '13'        =>          $sb,
                                  '14'        =>          ' '.$lang->upload['field16'],
                                  '15'        =>          ' '.$lang->upload['scene2']

In edit.php:

Find:
Code:

$postoptionstitle = array ('1' => $lang->edit['torrentname'], '2' => $lang->edit['nfofile'], '3' => $lang->upload['field21'], '4' => $lang->upload['field22'], '5' => $lang->edit['type'], '6' => $lang->edit['visible'], '7' => $lang->edit['au'], '8' => $fa, '9' => $ra, '10' => $ba, '11' => $sa, '12' => $lang->edit['offensive'], '13' => $na, '14' => $za, '15' => $da, '16' => $ca, '17' => $lang->upload['scene'], '18' => $lang->upload['finfo']);
And modify to:
Code:

$postoptionstitle = array ('1' => $lang->edit['torrentname'], '2' => $lang->edit['nfofile'], '3' => $lang->upload['field21'], '4' => $lang->upload['field22'], '5' => $lang->edit['type'], '6' => $lang->edit['genre'], '7' => $lang->edit['visible'], '8' => $lang->edit['au'], '9' => $fa, '10' => $ra, '11' => $ba, '12' => $sa, '13' => $lang->edit['offensive'], '14' => $na, '15' => $za, '16' => $da, '17' => $ca, '18' => $lang->upload['scene'], '18' => $lang->upload['finfo']);
Find:
Code:

Allowed file types: Jpg, Gif, Png', '4' => ' ' . (!empty ($row['t_link']) ? '[X]' : '') . '', '5' => $s, '6' => ' ' . $lang->edit['visible2'], '7' => '  ' . $lang->edit['au2'], '8' => $fb, '9' => $rb, '10' => $bb, '11' => $sb, '12' => ' ' . $lang->edit['offensive2'], '13' => $nb, '14' => $zb, '15' => $db, '16' => $cb, '17' => ' ' . $lang->upload['scene2'], '18' => '
mmisu120000 18th June 2009 10:43

[TSSE 5.x] Genre MOD
 
1 Attachment(s)
I'm working now at a Genre MOD for TSSE (my version id 5.4.1, but I think it can be adapted quickly in other 5.x versions).

I can't promise anything, I have very little time, but I;ll give it a try.
The minute it's ready, i'll post it for reviews and comments


Genre Mod v0.1 is ready!
I was inspired by RAW Genre Mod for TBDEV, but in TSSE 5.4.1 is really tricky, so i had to do it from scratch...

here are the files modified (see attachment)
inside archive are: browse.php, upload.php, edit.php, details.php, takeedit.php, takeupload.php and the lang. files necesary


Now, let's get to installation:

First, make one table in the database:

attention

Attention


Remember to backup db and files first!





Code:

ALTER TABLE `torrents` ADD `genre` VARCHAR( 40 ) NOT NULL ;
After that, extract the files from archive, and overwite the existing ones with them (the lang files are in /include/languages/english)

That should be it!

I will to make a step by step installation tutorial for those who are familiar to php, but right now, i'm tired, I worked on that all day ... so I've putted my modified files.




Ok, i think i finished the tutorial ... It's gonna be a HUUUUGE post...

Now, let's get to installation:
First, make one table in the database:
Code:

ALTER TABLE `torrents` ADD `genre` VARCHAR( 40 ) NOT NULL ;
File modifications:
Takeedit.php:


After:
Code:



  function validfilename ($name)
    {
      return preg_match ('/^[^\\0-\\x1f:\\\\\\/?*\\xff#<>|]+$/si', $name);
    }

Insert:
Code:



  function bark ($msg, $redirect = false)
    {
      global $lang;
      global $where;
      if ($redirect)
      {
        $where .= '&msg=' . base64_encode ($msg);
        header ('' . 'Location: ' . $where);
        exit ();
      }

Find:
Code:

$res = sql_query ('SELECT owner, filename, t_image, t_link, added FROM torrents WHERE id = ' . sqlesc ($id));
And modify:
Code:

$res = sql_query ('SELECT owner, filename, genre, t_image, t_link, added FROM torrents WHERE id = ' . sqlesc ($id));
Find:
Code:

{
        $updateset[] = 'allowcomments = \'no\'';
      }
    }

And add after that:
Code:

$genre = $_POST["genre"];
    if(empty($genre))
      {
                  bark($lang->edit['dicterror8']);
      }
  $genre1 = $_POST["genre1"];   
    if (empty($genre1))
        $genre1 = " ";
      else
                    $genre1 = " / " . $genre1 ;
  $genre2 = $_POST["genre2"];   
    if (empty($genre2))
        $genre2 = " ";
      else
                    $genre2 = " / " . $genre2 ;
  $genre .= $genre1 . $genre2;
  $updateset[] = 'genre = ' . sqlesc ($genre);

In takeupload.php:
Find:
Code:

$upload->url = $t_link;
        $upload->valid_link = array ('http://www.imdb.com/title/');
        $upload->file_type = 'imdb';
        $upload->check_url ();
        if (strstr ($t_link, 'imdb'))
        {
          include_once INC_PATH . '/ts_imdb.php';
        }
      }
    }

And add after that:
Code:

$genre = $_POST["genre"];
    if(empty($genre))
                  bark($lang->upload['dicterror8']);
 
  $genre1 = $_POST["genre1"];   
    if (empty($genre1))
        $genre1 = " ";
      else
                    $genre1 = " / " . $genre1 ;
  $genre2 = $_POST["genre2"];   
    if (empty($genre2))
        $genre2 = " ";
      else
                    $genre2 = " / " . $genre2 ;
  $genre .= $genre1 . $genre2;

Find:
Code:

$ret = sql_query ('INSERT INTO torrents (t_image, t_link, filename, owner, visible, anonymous, free, silver, sticky, offensive, info_hash, name, size, numfiles, descr, category, added, last_action, ' . $q1 . 'nfo' . $sql1 . ') VALUES (' . implode (',', array_map ('sqlesc', array ((!empty ($t_image) ? $t_image : (!empty ($cover_photo_name) ? $BASEURL . '/' . $cover_photo_name : '')), (!empty ($t_link) ? $t_link : ''), $fname, $CURUSER['id'], $visible, $anonymous, $free, $silver, $sticky, $offensive, $infohash, $torrent, $totallen, count ($filelist), $descr, 0 + $_POST['type']))) . ', \'' . get_date_time () . '\', \'' . get_date_time () . '\', ' . $q2 . $nfo . $sql2 . ')');
And replace with:
Code:

$ret = sql_query ('INSERT INTO torrents (t_image, t_link, filename, genre, owner, visible, anonymous, free, silver, sticky, offensive, info_hash, name, size, numfiles, descr, category, added, last_action, ' . $q1 . 'nfo' . $sql1 . ') VALUES (' . implode (',', array_map ('sqlesc', array ((!empty ($t_image) ? $t_image : (!empty ($cover_photo_name) ? $BASEURL . '/' . $cover_photo_name : '')), (!empty ($t_link) ? $t_link : ''), $fname, $genre, $CURUSER['id'], $visible, $anonymous, $free, $silver, $sticky, $offensive, $infohash, $torrent, $totallen, count ($filelist), $descr, 0 + $_POST['type']))) . ', \'' . get_date_time () . '\', \'' . get_date_time () . '\', ' . $q2 . $nfo . $sql2 . ')');
Find
Code:

'.$showwait.' '.$name_torrent.''.'"genre'.$isScene.' '.$showwait.' '.$name_torrent.''.'  Genre: '.$genre.''.$isScene.'

And modify to:
Code:

Allowed file types: Jpg, Gif, Png', '4' => ' ' . (!empty ($row['t_link']) ? '[X]' : '') . '', '5' => $s, '6' => $genre, '7' => ' ' . $lang->edit['visible2'], '8' => '  ' . $lang->edit['au2'], '9' => $fb, '10' => $rb, '11' => $bb, '12' => $sb, '13' => ' ' . $lang->edit['offensive2'], '14' => $nb, '15' => $zb, '16' => $db, '17' => $cb, '18' => ' ' . $lang->upload['scene2'], '19' => '

Find:
Code:

$postoptions = array ('1' => '
                                                 
                                                  ', '2' => '
                                                  ' . $lang->edit['keepcurrent'] . '
                                                  ' . $lang->edit['update'] . '
                                                  ', '3' => '
                                                 

                                                  ' . (!empty ($row['t_image']) ? '[X]' : '') . '
                                                 

                                                 
                                                  Allowed file types: Jpg, Gif, Png', '4' => ' ' . (!empty ($row['t_link']) ? '[X]' : '') . '', '5' => $s, '6' => ' ' . $lang->edit['visible2'], '7' => '  ' . $lang->edit['au2'], '8' => $fb, '9' => $rb, '10' => $bb, '11' => $sb, '12' => ' ' . $lang->edit['offensive2'], '13' => $nb, '14' => $zb, '15' => $db, '16' => $cb, '17' => ' ' . $lang->upload['scene2'], '18' => '

And modify to:
Code:

$postoptionstitle = array ('1' => $lang->edit['torrentname'], '2' => $lang->edit['nfofile'], '3' => $lang->upload['field21'], '4' => $lang->upload['field22'], '5' => $lang->edit['type'], '6' => $lang->edit['genre'], '7' => $lang->edit['visible'], '8' => $lang->edit['au'], '9' => $fa, '10' => $ra, '11' => $ba, '12' => $sa, '13' => $lang->edit['offensive'], '14' => $na, '15' => $za, '16' => $da, '17' => $ca, '18' => $lang->upload['scene'], '18' => $lang->upload['finfo']);
    $query = sql_query ('SELECT video_info, audio_info FROM ts_torrents_details WHERE tid = ' . sqlesc ($id));
    if (0 < mysql_num_rows ($query))
    {
      $Torrent_Details = mysql_fetch_assoc ($query);
      $video_info = @explode ('~', $Torrent_Details['video_info']);
      $audio_info = @explode ('~', $Torrent_Details['audio_info']);
    }
 
    $postoptions = array ('1' => '
                                                 
                                                  ', '2' => '
                                                  ' . $lang->edit['keepcurrent'] . '
                                                  ' . $lang->edit['update'] . '
                                                  ', '3' => '
                                                 

                                                  ' . (!empty ($row['t_image']) ? '[X]' : '') . '
                                                 

                                                 
                                                  Allowed file types: Jpg, Gif, Png', '4' => ' ' . (!empty ($row['t_link']) ? '[X]' : '') . '', '5' => $s, '6' => $genre, '7' => ' ' . $lang->edit['visible2'], '8' => '  ' . $lang->edit['au2'], '9' => $fb, '10' => $rb, '11' => $bb, '12' => $sb, '13' => ' ' . $lang->edit['offensive2'], '14' => $nb, '15' => $zb, '16' => $db, '17' => $cb, '18' => ' ' . $lang->upload['scene2'], '19' => '

Find:
Code:

$res = sql_query ('SELECT filename,owner,name,descr,category,visible,anonymous,free,silver,banned,sticky,offensive,t_image,t_link,isnuked,isrequest,doubleupload,allowcomments,isScene FROM torrents WHERE id = ' . sqlesc ($id));
And modify to:
Code:

$res = sql_query ('SELECT filename,owner,name,descr,category,genre,visible,anonymous,free,silver,banned,sticky,offensive,t_image,t_link,isnuked,isrequest,doubleupload,allowcomments,isScene FROM torrents WHERE id = ' . sqlesc ($id));
Find:
Code:

$cb = ' ' . $lang->edit['cb'];
    }

And add after that:
Code:

$genre = '  <= REQUIRED!   
   
  /
 
  <=  (optional)';

In details.php:
Find:
Code:


                                 

                                 

                 

And add after that:
Code:


                 

                 

 

Find:
Code:

$query = sql_query('SELECT t.name, t.allowcomments, t.banned, t.descr, t.category, t.size, t.numfiles, LENGTH(t.nfo) AS nfosz, t.anonymous, t.added, t.comments, t.hits, t.times_completed, t.leechers, t.seeders, t.owner, t.free, t.sticky, t.offensive, t.silver, t.t_image, t.t_link, t.isnuked, t.WhyNuked, t.isrequest, t.ts_external, t.doubleupload, t.isScene, c.name as categoryname, c.vip, c.pid, c.type, c.id as categoryid, d.video_info, d.audio_info, u.username, u.donor, u.warned, u.leechwarn, g.namestyle FROM torrents t LEFT JOIN categories c ON (t.category=c.id) LEFT JOIN ts_torrents_details d ON (t.id=d.tid) LEFT JOIN users u ON (t.owner=u.id) LEFT JOIN usergroups g ON (u.usergroup=g.gid) WHERE t.id = '.sqlesc($id)) or sqlerr(__FILE__,__LINE__);
And modify to:
Code:

$query = sql_query('SELECT t.name, t.genre, t.allowcomments, t.banned, t.descr, t.category, t.size, t.numfiles, LENGTH(t.nfo) AS nfosz, t.anonymous, t.added, t.comments, t.hits, t.times_completed, t.leechers, t.seeders, t.owner, t.free, t.sticky, t.offensive, t.silver, t.t_image, t.t_link, t.isnuked, t.WhyNuked, t.isrequest, t.ts_external, t.doubleupload, t.isScene, c.name as categoryname, c.vip, c.pid, c.type, c.id as categoryid, d.video_info, d.audio_info, u.username, u.donor, u.warned, u.leechwarn, g.namestyle FROM torrents t LEFT JOIN categories c ON (t.category=c.id) LEFT JOIN ts_torrents_details d ON (t.id=d.tid) LEFT JOIN users u ON (t.owner=u.id) LEFT JOIN usergroups g ON (u.usergroup=g.gid) WHERE t.id = '.sqlesc($id)) or sqlerr(__FILE__,__LINE__);
Now, the lang files:
In /include/languages/english/upload.lang.php:
Add this line:
Code:

'dicterror8'                                          =>'You must enter at least a genre!',
In /include/languages/english/edit.lang.php:
Add this line:
Code:

'dicterror8'                                          =>'You must enter at least a genre!',
In /include/languages/english/details.lang.php:
Add this line:
Code:

'genre'                                                                                  =>'Genre',
And that should be it!
If I forgot something, just tell me and I’ll try to compare the original files with mine, and I’ll post the correction.
Good luck!
'.$lang->details['type'].''.$torrent['categoryname'].'
'.$lang->details['genre'].''.$torrent['genre'].'

Muikku 20th June 2009 12:17

Is that packed all ready to fix? or must i do that all change in that php file? or can i upload that packed files my tracker and owerwrite old php files and put that sql in my database and then all works whit genre mod?

Thanx nice mod anyway :)

mmisu120000 21st June 2009 00:19

the modified files are in the pack ... the step by step tutorial is for those who want to make more modifications

Ashur 21st June 2009 02:01

cool so is this genre mod global to all categories or can you specify which category to have it?

i.e. for anime, films, series --> have similar genre
but for music & music videos --> different type of genre
and for application --> no need

looking great so far :D

Muikku 21st June 2009 10:08

Quote:

Originally Posted by mmisu120000 (Post 12546)
the modified files are in the pack ... the step by step tutorial is for those who want to make more modifications

ok nice

but now i have one proplem i think that sql table is not working
can yoy make workking database sql table and post it here?

mmisu120000 21st June 2009 10:44

Quote:

Originally Posted by Ashur (Post 12553)
cool so is this genre mod global to all categories or can you specify which category to have it?

i.e. for anime, films, series --> have similar genre
but for music & music videos --> different type of genre
and for application --> no need

looking great so far :D

it's global, but you can edit the genres in those 2 files ...
there is 1 minimum genre mandatory, the other 2 are optional ... This way you don't add more load to your tracker.
There is an other way, mysql based, i'll make an other version, in wich you can edit your genres in admin panel ... but that's more difficult and tricky ... I'll see what I can do ...

Ashur 21st June 2009 16:37

files are better :)
they're just options so there is no real need to be stored in sql so less pull on sql
i think if we switch many useless options of TS to file system we might able to save tons of CPU load on servers

Muikku 30th December 2009 21:03

can someone fix this genremod becouse only staff can edit torrent and put genre back user canīt but genre if they edit own torrentīs

turktiger 20th January 2011 10:05

what is genre mod , u re only writing smtg and no information ??


images re dead :S :smack:

Marco 9th February 2011 17:29

it's something like torrentleech even if the torrent is in the category (divx) they also have a genre (comedy,drama,horror, romance ....) with this mod will shown on your tracker what kind of category is the movie


very nice mod :)


All times are GMT +2. The time now is 14:21.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.