Plugin Directory

Changeset 1455925


Ignore:
Timestamp:
07/17/2016 08:31:57 AM (10 years ago)
Author:
xnicoco
Message:

fixed statistics in admin info page and a little improvement in magnet link redirection

Location:
katracker/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • katracker/trunk/README.txt

    r1435432 r1455925  
    7171
    7272== Changelog ==
     73= 1.0.9 =
     74* Fixed statistics in admin page
     75* Minor bug fixes
     76
    7377= 1.0.8 =
    7478* Bug fixes (note to self: do not commit after 2AM)
  • katracker/trunk/functions.php

    r1434444 r1455925  
    127127    global $wpdb;
    128128    return $wpdb->get_var(
    129             // select total seeders
    130             'SELECT SUM( state=1 ) ' .
     129            // select total count
     130            'SELECT count( * ) ' .
    131131            // from peers
    132132            "FROM `" . KATRACKER_DB_PREFIX . "peers` " .
    133133            // that match info_hash
    134             ( isset( $torrent_id ) ? "WHERE info_hash = '" . get_torrent_meta( $torrent_id, 'hash-info' ) . "'" : '' )
     134            ( isset( $torrent_id ) ? "WHERE info_hash = '" . get_torrent_meta( $torrent_id, 'hash-info' ) . "' AND " : "WHERE " ) .
     135            // and are currently seeding
     136            "state = 1"
    135137           ) + 0;
    136138}
     
    145147    global $wpdb;
    146148    return $wpdb->get_var(
    147             // select total leechers
    148             'SELECT SUM( state=0 ) ' .
     149            // select total count
     150            'SELECT count( * ) ' .
    149151            // from peers
    150152            "FROM `" . KATRACKER_DB_PREFIX . "peers` " .
    151153            // that match info_hash
    152             ( isset( $torrent_id ) ? "WHERE info_hash = '" . get_torrent_meta( $torrent_id, 'hash-info' ) . "'" : '' )
    153            ) + 0;
     154            ( isset( $torrent_id ) ? "WHERE info_hash = '" . get_torrent_meta( $torrent_id, 'hash-info' ) . "' AND " : "WHERE " ) .
     155            // and are currently leeching
     156            "state = 0"
     157    ) + 0;
    154158}
    155159
     
    191195    return $wpdb->get_var(
    192196            // select count
    193             "SELECT COUNT( DISTINCT `info_hash` ) " .
     197            "SELECT COUNT( * ) " .
    194198            // from wordpress posts table
    195             "FROM `" . KATRACKER_DB_PREFIX . "peers`"
     199            "FROM `{$wpdb->posts}` " .
     200            // only attachment
     201            "WHERE post_type = 'attachment' " .
     202            // of type torrent
     203            "AND post_mime_type = 'torrent/torrent'"
    196204           ) + 0;
    197205}
  • katracker/trunk/katracker.php

    r1434444 r1455925  
    55 * Description: The only full and all powerful, complete bittorrent tracker integration for wordpress.
    66 * Author: nicoco
    7  * Version: 1.0.8
     7 * Version: 1.0.9
    88 * Author URI: kateam.org
    99 * License: GPL2
  • katracker/trunk/tracker/tracker-download.php

    r1407729 r1455925  
    3939    update_torrent_meta( $_GET['torrent'], 'hits', $hits + 1);
    4040   
    41     exit( $torrent->send( $filename . '.torrent' ) );
     41    $torrent->send( $filename . '.torrent' );
     42    exit;
    4243}
    4344
  • katracker/trunk/tracker/tracker-magnet.php

    r1433917 r1455925  
    1212     get_katracker_option( 'tracked-access' ) ||
    1313     get_katracker_option( 'open-tracker' ) ) {
    14 
    1514    if ( $magnet = get_torrent_meta( $_GET['torrent'], 'magnet' ) ) {
    16         increment_torrent_hits( $_GET['torrent'] );
    17         exit( wp_redirect( $magnet ) );
     15        update_torrent_meta( $_GET['torrent'], 'completed', get_torrent_meta( $_GET['torrent'], 'completed' ) + 1 );
     16        wp_redirect( $magnet ); ?>
     17            <a href="javascript:history.go(-1)" style="position:absolute;right:50%;">Back</a>
     18        <?php exit;
    1819    }
    1920}
Note: See TracChangeset for help on using the changeset viewer.