Changeset 1407729
- Timestamp:
- 04/29/2016 06:35:11 PM (10 years ago)
- Location:
- katracker
- Files:
-
- 2 added
- 3 deleted
- 12 edited
-
assets/icon-128x128.png (added)
-
assets/icon-256x256.png (added)
-
trunk/admin/admin-page.php (modified) (1 diff)
-
trunk/admin/media-button.php (modified) (1 diff)
-
trunk/admin/media-list.php (modified) (5 diffs)
-
trunk/admin/section-1-info.php (modified) (3 diffs)
-
trunk/admin/section-2-tracker.php (modified) (1 diff)
-
trunk/functions.php (modified) (4 diffs)
-
trunk/katracker.php (modified) (2 diffs)
-
trunk/lang/he_IL.pot (deleted)
-
trunk/lang/katracker-he_IL.mo (deleted)
-
trunk/lang/katracker-he_IL.po (deleted)
-
trunk/torrent/torrent-media.php (modified) (1 diff)
-
trunk/tracker/katracker.core.php (modified) (2 diffs)
-
trunk/tracker/tracker-announce.php (modified) (3 diffs)
-
trunk/tracker/tracker-download.php (modified) (1 diff)
-
trunk/tracker/tracker-scrape.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
katracker/trunk/admin/admin-page.php
r1398530 r1407729 14 14 ?> 15 15 <div class="wrap"> 16 <h1>< ?php _e( 'KatrackerSettings', 'katracker' ); ?></h1>16 <h1><span style="height:38px;width:140px;background:url('<?php echo plugin_dir_url( __FILE__ ) . 'SettingsLogo.png'; ?>') no-repeat;background-size:140px 38px;display:inline-block;" ></span> <?php _e( 'Settings', 'katracker' ); ?></h1> 17 17 <h2 class="nav-tab-wrapper"> 18 18 <?php -
katracker/trunk/admin/media-button.php
r1398530 r1407729 1 1 <?php 2 2 3 // License Information ///////////////////////////////////////////////////////////////////////////// 4 5 /* 6 * KaTracker - BitTorrent Tracker Wordpress Plugin 7 * Based mostly on peertracker, https://github.com/JonnyJD/peertracker 8 * and ported to use the native wordpress functions by nicoco of KaTeam 9 * Copyright (C) 2015 http://www.kateam.org/ 10 * 11 * katracker is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation, either version 3 of the License, or 14 * (at your option) any later version. 15 * 16 * KaTracker is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with KaTracker. If not, see <http://www.gnu.org/licenses/>. 23 */ 3 // Add Torrent Button ////////////////////////////////////////////////////////////////////////////// 24 4 25 5 -
katracker/trunk/admin/media-list.php
r1398530 r1407729 15 15 $cols['leechers'] = '<span title="'.__( 'Leechers', 'katracker' ).'">Le</span>'; 16 16 $cols['seeders'] = '<span title="'.__( 'Seeders', 'katracker' ).'">Se</span>'; 17 $cols['hits'] = '<span title="'.__( 'Hits', 'katracker' ).'">Hits</span>'; 17 18 // $cols['shortcode'] = '<span title="'.__( 'Shortcode', 'katracker' ).'">Shortcode</span>'; 18 19 return $cols; … … 33 34 case 'seeders': 34 35 echo '<span style="color: green;">' . get_torrent_meta( $torrent_id, 'seeders' ) . '</span>'; 36 break; 37 case 'hits': 38 echo '<span style="color: black;">' . get_torrent_meta( $torrent_id, 'hits' ) . '</span>'; 35 39 break; 36 40 // case 'shortcode': … … 54 58 $cols['leechers'] = 'leechers'; 55 59 $cols['seeders'] = 'seeders'; 60 $cols['hits'] = 'hits'; 56 61 return $cols; 57 62 } ); … … 94 99 $query->set( 'orderby','meta_value_num' ); 95 100 break; 101 case 'hits': 102 $query->set( 'meta_key', KATRACKER_META_PREFIX . 'hits' ); 103 $query->set( 'orderby','meta_value_num' ); 104 break; 96 105 } 97 106 } ); … … 111 120 .column-date, .column-author, .column-size, .column-shortcode {width: 5em;} 112 121 .column-taxonomy-<?php echo KATRACKER_CATEGORY; ?> {width: 9em;} 113 .column-leechers, .column-seeders {width: 2.7em;}122 .column-leechers, .column-seeders, .column-hits {width: 2.7em;} 114 123 .column-tracked {width: 4.15em;} 115 124 </style> -
katracker/trunk/admin/section-1-info.php
r1398530 r1407729 18 18 19 19 add_settings_section( 20 KATRACKER_PREFIX . 'section-'.$katracker_section[basename( __FILE__ )]['name'], 20 KATRACKER_PREFIX . 'section-'.$katracker_section[basename( __FILE__ )]['name'], 21 21 __( $katracker_section[basename( __FILE__ )]['title'], 'katracker' ), 22 22 function () { 23 $url = array( 23 $url = array( 24 24 'announce' => get_katracker_url( 'announce' ), 25 25 'scrape' => get_katracker_url( 'scrape' ), … … 28 28 $stats = get_torrent_stats(); 29 29 ?> 30 <p><strong><?php echo get_katracker_option( 'active' ) ? __( 'The tracker is up and running.', 'katracker' ) : __( 'The tracker is disabled.', 'katracker' ); ?></strong></p> 30 31 <table> 31 32 <thead><th colspan="2"><?php _e( 'Useful Tracker Urls', 'katracker' ); ?></th></thead> … … 60 61 </table> 61 62 <?php 62 }, 63 }, 63 64 $katracker_section[basename( __FILE__ )]['name'] 64 65 ); -
katracker/trunk/admin/section-2-tracker.php
r1398530 r1407729 24 24 }, 25 25 $katracker_section[basename( __FILE__ )]['name'] 26 ); 27 28 register_setting( $katracker_section[basename( __FILE__ )]['name'], KATRACKER_PREFIX . 'active' ); 29 add_settings_field( 30 KATRACKER_PREFIX . 'active', 31 __( 'Activate Tracker', 'katracker' ), 32 function () { 33 $option = get_katracker_option( 'active' ); 34 echo '<input type="radio" name="' . KATRACKER_PREFIX . 'active" value="1" ' . checked( $option, 1, false ) . '>' . __( 'Yes', 'katracker' ) . '</br>' . 35 '<input type="radio" name="' . KATRACKER_PREFIX . 'active" value="0" ' . checked( $option, 0, false ) . '>' . __( 'No', 'katracker' ); 36 }, 37 $katracker_section[basename( __FILE__ )]['name'], 38 KATRACKER_PREFIX . 'section-' . $katracker_section[basename( __FILE__ )]['name'], 39 array( 'label_for' => KATRACKER_PREFIX . 'active' ) 26 40 ); 27 41 -
katracker/trunk/functions.php
r1398530 r1407729 101 101 'SELECT post_id ' . 102 102 // from postmeta 103 "FROM $wpdb->postmeta " .103 "FROM $wpdb->postmeta " . 104 104 // that match hash_info 105 105 "WHERE meta_value = %s", … … 370 370 $options = array( 371 371 'init' => 1, 372 'acitve' => 1, 372 373 'validate-hash' => 1, 373 374 'labels' => '', … … 423 424 'post_status' => null 424 425 ) ); 425 426 426 427 $success = true; 427 428 428 429 foreach ( $torrents as $torrent ) { 429 430 $success &= ( bool )wp_delete_post( $torrent->ID, true ); 430 431 } 431 432 432 433 return $success; 433 434 case 'full': … … 493 494 'track' => 0, 494 495 'update-title' => 1, 496 'hits' => 0, 495 497 'seeders' => 0, 496 498 'leechers' => 0 497 499 ); 498 500 499 501 $success = true; 500 502 501 503 if ( !isset( $attachment_id ) && $uninstall ) { 502 504 foreach( array_keys( $metadata ) as $key ) { -
katracker/trunk/katracker.php
r1398530 r1407729 5 5 * Description: The only full and all powerful, complete bittorrent tracker integration for wordpress. 6 6 * Author: nicoco 7 * Version: 1.0. 17 * Version: 1.0.2 8 8 * Author URI: kateam.org 9 9 * License: GPL2 10 */10 */ 11 11 12 12 // Include dependencies //////////////////////////////////////////////////////////////////////////// … … 47 47 // Setup Tracker File Loading ////////////////////////////////////////////////////////////////////// 48 48 add_action( 'plugins_loaded', function () { 49 if ( $katracker_slug = get_katracker_option( 'slug' ) ){49 if ( get_katracker_option( 'active' ) && $katracker_slug = get_katracker_option( 'slug' ) ){ 50 50 $current = array(); 51 51 if ( get_option( 'permalink_structure' ) ) { -
katracker/trunk/torrent/torrent-media.php
r1398530 r1407729 154 154 function print_torrent_info( $torrent_id ) { 155 155 if ( is_object( $torrent_id ) ) $torrent_id = $torrent_id->ID; 156 // grub torrent file info157 $stats = get_torrent_stats( $torrent_id );158 156 $torrent_data = array( 159 157 array( 160 'lable' => __( 'Name' ), 161 'name' => 'name', 162 'class' => 'code', 163 'data' => get_torrent_meta( $torrent_id, 'name' ) 164 ), 165 array( 166 'lable' => __( 'Hash Info', 'katracker' ), 167 'name' => 'hash-info', 168 'class' => 'code', 169 'data' => get_torrent_meta( $torrent_id, 'hash-info' ) 170 ), 171 array( 172 'lable' => __( 'Leechers', 'katracker' ), 173 'name' => 'leechers', 174 'class' => 'code', 175 'data' => get_torrent_meta( $torrent_id, 'leechers' ) 176 ), 177 array( 178 'lable' => __( 'Seeders', 'katracker' ), 179 'name' => 'seeders', 180 'class' => 'code', 181 'data' => get_torrent_meta( $torrent_id, 'seeders' ) 182 ), 183 array( 184 'lable' => __( 'Piece Length', 'katracker' ), 185 'name' => 'piece-length', 186 'class' => 'code', 187 'data' => TorrentFile::format( get_torrent_meta( $torrent_id, 'piece-length' ) ) 188 ), 189 array( 190 'lable' => __( 'Total Size', 'katracker' ), 191 'name' => 'size', 192 'class' => 'code', 193 'data' => TorrentFile::format( get_torrent_meta( $torrent_id, 'size' )) 194 ), 195 array( 196 'lable' => __( 'Announces', 'katracker' ), 197 'name' => 'announce', 198 'class' => 'urlfield code', 199 'textarea' => true, 200 'data' => get_torrent_meta( $torrent_id, 'announce' ) 201 ), 202 array( 203 'lable' => __( 'Comment', 'katracker' ), 204 'name' => 'comment', 205 'class' => 'code', 206 'textarea' => true, 207 'data' => get_torrent_meta( $torrent_id, 'comment' ) 158 __( 'Name' ), 159 'name', 160 'code', 161 get_torrent_meta( $torrent_id, 'name' ) 162 ), 163 array( 164 __( 'Hash Info', 'katracker' ), 165 'hash-info', 166 'code', 167 get_torrent_meta( $torrent_id, 'hash-info' ) 168 ), 169 array( 170 __( 'Leechers', 'katracker' ), 171 'leechers', 172 'code', 173 get_torrent_meta( $torrent_id, 'leechers' ) 174 ), 175 array( 176 __( 'Seeders', 'katracker' ), 177 'seeders', 178 'code', 179 get_torrent_meta( $torrent_id, 'seeders' ) 180 ), 181 array( 182 __( 'Hits', 'katracker' ), 183 'hits', 184 'code', 185 get_torrent_meta( $torrent_id, 'hits' ) 186 ), 187 array( 188 __( 'Piece Length', 'katracker' ), 189 'piece-length', 190 'code', 191 TorrentFile::format( get_torrent_meta( $torrent_id, 'piece-length' ) ) 192 ), 193 array( 194 __( 'Total Size', 'katracker' ), 195 'size', 196 'code', 197 TorrentFile::format( get_torrent_meta( $torrent_id, 'size' )) 198 ), 199 array( 200 __( 'Announces', 'katracker' ), 201 'announce', 202 'urlfield code', 203 get_torrent_meta( $torrent_id, 'announce' ), 204 true, 205 ), 206 array( 207 __( 'Comment', 'katracker' ), 208 'comment', 209 'code', 210 get_torrent_meta( $torrent_id, 'comment' ), 211 true 208 212 ), 209 213 ); 210 214 foreach( $torrent_data as $data ): ?> 211 <label for="torrent_data_<?php echo $data[ 'name']; ?>"><?php echo $data['lable']; ?></label>212 <?php if ( isset( $data[ 'textarea'] ) ): ?>213 <textarea name="attachments[<?php echo $torrent_id; ?>][<?php echo $data[ 'name']; ?>]" id="torrent_data_<?php echo $data['name']; ?>" class="widefat <?php echo $data['class']; ?>" type="text"><?php echo $data['data']; ?></textarea>215 <label for="torrent_data_<?php echo $data[1]; ?>"><?php echo $data[0]; ?></label> 216 <?php if ( isset( $data[4] ) ): ?> 217 <textarea name="attachments[<?php echo $torrent_id; ?>][<?php echo $data[1]; ?>]" id="torrent_data_<?php echo $data[1]; ?>" class="widefat <?php echo $data[2]; ?>" type="text"><?php echo $data[3]; ?></textarea> 214 218 <?php else: ?> 215 <input readonly="readonly" name="torrent_data_<?php echo $data[ 'name']; ?>" id="torrent_data_<?php echo $data['name']; ?>" class="widefat <?php echo $data['class']; ?>" onClick="this.select();" type="text" value="<?php echo $data['data']; ?>"></input>219 <input readonly="readonly" name="torrent_data_<?php echo $data[1]; ?>" id="torrent_data_<?php echo $data[1]; ?>" class="widefat <?php echo $data[2]; ?>" onClick="this.select();" type="text" value="<?php echo $data[3]; ?>"></input> 216 220 <?php endif; 217 221 endforeach; -
katracker/trunk/tracker/katracker.core.php
r1398530 r1407729 7 7 * The tracker functionality mostly on peertracker's mysql version, 8 8 * and ported to use native wordpress functions. 9 * 9 * 10 10 * For more information about the peertracker project, 11 11 * please visit https://github.com/JonnyJD/peertracker … … 389 389 390 390 /** 391 * Flush Torrent Statistics 392 */ 393 public static function flush_statistics() 394 { 395 if ( !$torrent_id = get_torrent_id_from_hash( $_GET['info_hash'] ) ) return; 396 397 global $wpdb; 398 $stats = get_torrent_stats( $torrent_id ); 399 400 update_torrent_meta( $torrent_id, 'seeders', $stats['seeders'] ); 401 update_torrent_meta( $torrent_id, 'leechers', $stats['leechers'] ); 402 } 403 404 /** 391 405 * check if the torrent approved by the tracker 392 406 */ 393 public static function katracker_validate()407 public static function validate() 394 408 { 395 409 if ( $_SERVER['tracker']['open_tracker'] ) return; -
katracker/trunk/tracker/tracker-announce.php
r1398530 r1407729 6 6 * The tracker functionality mostly on peertracker's mysql version, 7 7 * and ported to use native wordpress functions. 8 * 8 * 9 9 * For more information about the peertracker project, 10 10 * please visit https://github.com/JonnyJD/peertracker … … 82 82 else $_GET['numwant'] += 0; 83 83 84 // get the torrent id from the hash85 $_GET['torrent_id'] = get_torrent_id_from_hash( $_GET['info_hash'] );86 87 84 // Handle Request ////////////////////////////////////////////////////////////////////////////////// 85 // flush wordpress statistics 86 KatrackerCore::flush_statistics(); 88 87 89 88 // check if the torrent is approved by the tracker … … 96 95 KatrackerCore::event(); 97 96 98 // if the torrent exists in wordpress database, update the metadata99 if ( $torrent_id = get_torrent_id_from_hash( $_GET['info_hash'] ) ) {100 update_torrent_meta( $torrent_id, 'seeders', get_torrent_seeders( $torrent_id ) );101 update_torrent_meta( $torrent_id, 'leechers', get_torrent_leechers( $torrent_id ) );102 }103 97 104 98 exit; -
katracker/trunk/tracker/tracker-download.php
r1398530 r1407729 36 36 preg_replace( '/,/', '', $torrent->name() ); 37 37 38 $hits = get_torrent_meta( $_GET['torrent'], 'hits'); 39 update_torrent_meta( $_GET['torrent'], 'hits', $hits + 1); 40 38 41 exit( $torrent->send( $filename . '.torrent' ) ); 39 42 } -
katracker/trunk/tracker/tracker-scrape.php
r1398530 r1407729 51 51 // Handle Request ////////////////////////////////////////////////////////////////////////////////// 52 52 53 // check if the torrent is approved by the tracker 54 KatrackerCore::validate(); 55 53 56 // perform scrape 54 57 KatrackerCore::scrape();
Note: See TracChangeset
for help on using the changeset viewer.