diff --git a/bt/robots.txt b/bt/robots.txt deleted file mode 100644 index 989b57ac8..000000000 --- a/bt/robots.txt +++ /dev/null @@ -1,8 +0,0 @@ -User-agent: * -Disallow: /bt/ - -User-agent: Yandex -Disallow: /bt/ - -User-agent: YandexBot -Disallow: /bt/ \ No newline at end of file diff --git a/install/other/converter/TBDevYSE_pre6/ReadMe.txt b/install/other/converter/TBDevYSE_pre6/ReadMe.txt deleted file mode 100644 index 198424165..000000000 --- a/install/other/converter/TBDevYSE_pre6/ReadMe.txt +++ /dev/null @@ -1,21 +0,0 @@ -TBDev Yuna Scatari Edition pre6 to TorrentPier 1.0.x converter. - -Quick guide: -1. Install and configure TorrentPier 1.0.0 or higher. -2. Import your TBDevYSE database into TorrentPier database (concretely 'comments', 'categories', 'torrents' and 'users' tables). -3. Put the contents of folder 'root' into your TorrentPier root. -4. Configure 'converter/settings.php' for optimal settings. -5. Run convert.php. -6. See 'converter/passwords.php' for new password to login under admin account. -7. Resychronize statistics using admin panel. -8. Make your new tracker popular! ----- -9. If you need to notify users for new passwords (which are needed to login in TorrentPier) via TBDevYSE PM system, - copy two files: automatically generated 'converter/passwords.php' and 'for_tbdev/pass.php' to your TBDevYSE root and run pass.php - (Don't forget to remove these files after completion). - You allow to change message text, see $msg in pass.php for this. -10. If you want to redirect peers from older announce to new announce everytime, replace original TBDev's announce.php with - 'for_tbdev/announce.php' - -Cheers, RoadTrain. -http://torrentpier.me/ \ No newline at end of file diff --git a/install/other/converter/TBDevYSE_pre6/for_tbdev/announce.php b/install/other/converter/TBDevYSE_pre6/for_tbdev/announce.php deleted file mode 100644 index ac21cfafb..000000000 --- a/install/other/converter/TBDevYSE_pre6/for_tbdev/announce.php +++ /dev/null @@ -1,82 +0,0 @@ - -
-
- -
-
- '; -} else { - if (!file_exists('passwords.php')) { - stderr($tracker_lang['error'], 'passwords.php not exists'); - } - - include('passwords.php'); - stdhead(); - foreach ($passwords as $user) { - $msg_sql = sprintf($msg, $user['username'], $user['new_passwd']); - sql_query("INSERT INTO messages (receiver, added, subject, msg) VALUES({$user['tb_user_id']}, NOW(), " . sqlesc($subject) . ", " . sqlesc($msg_sql) . ")"); - } - stdmsg('OK', 'Mass PM succesful'); -} - -stdfoot(); diff --git a/install/other/converter/TBDevYSE_pre6/root/convert.php b/install/other/converter/TBDevYSE_pre6/root/convert.php deleted file mode 100644 index 091fa1ac4..000000000 --- a/install/other/converter/TBDevYSE_pre6/root/convert.php +++ /dev/null @@ -1,269 +0,0 @@ -session_start(); - -if (!IS_ADMIN) { - die("Restricted access"); -} -while (@ob_end_flush()) ; -ob_implicit_flush(); - -error_reporting(E_ALL); -@ini_set('display_errors', 1); - -?> - - - - - - - - - - -
-
- -
-
- - '; - - exit; -} else { - @ini_set('memory_limit', '512M'); - @ini_set('max_execution_time', @ini_get('max_execution_time') + 1200); - -// Step 1: Converting Users - if (CONVERT_USERS) { - if (CLEAN) { - tp_users_cleanup(); - print_ok("Users cleared"); - } - - $max_uid = (int)get_max_val(BB_USERS, 'user_id'); - $max_uid = ($max_uid > 1) ? $max_uid : 1; - - $users_count = (int)get_count(TB_USERS_TABLE, 'id'); - $loops = (int)ceil($users_count / C_USERS_PER_ONCE); - $pass = array(); - - switch (TR_TYPE) { - case 'yse': - $_sql = 'avatar, '; - break; - - default: - $_sql = ''; - break; - } - - for ($i = 0; $i < $loops; $i++) { - $start = $i * C_USERS_PER_ONCE; - $offset = C_USERS_PER_ONCE; - - $sql = " - SELECT - id, username, email, status, UNIX_TIMESTAMP(added) AS added, UNIX_TIMESTAMP(last_access) AS last_access, - class, icq, msn, aim, yahoo, website, $_sql - uploaded, downloaded, enabled, language - FROM " . TB_USERS_TABLE . " - ORDER BY id - LIMIT $start, $offset"; - - $users = DB()->fetch_rowset($sql); - DB()->sql_freeresult(); - - foreach ($users as $user) { - $user['id'] += $max_uid; - $user['password'] = make_rand_str(15); - convert_user($user); - $pass[] = array( - 'tb_user_id' => $user['id'] - $max_uid, - 'username' => $user['username'], - 'new_passwd' => $user['password'], - ); - } - } - $passf = fopen('./converter/passwords.php', 'w'); - $to_write = " $tr_cat_id, - "cat_title" => 'Tracker', - ); - tp_add_category($tp_cat_data); - set_auto_increment(BB_CATEGORIES, 'cat_id'); - unset($tp_cat_data); - - $cats = $db->fetch_rowset("SELECT id, sort, name FROM " . TB_CATEGORIES_TABLE); - DB()->sql_freeresult(); - - $max_forum_id = (int)get_max_val(BB_FORUMS, 'forum_id'); - - foreach ($cats as $cat) { - $cat['id'] += $max_forum_id; - $cat['cat_id'] = $tr_cat_id; - convert_cat($cat); - } - set_auto_increment(BB_FORUMS, 'forum_id'); - print_ok("Categories from TBDev converted"); - unset($cats); - - // Start of torrents converting - switch (TR_TYPE) { - case 'yse': - $_sql = 'image1, image2, '; - break; - - case 'sky': - $_sql = 'poster, screenshot1, screenshot2, screenshot3, screenshot4, '; - break; - - default: - $_sql = ''; - break; - } - - $max_topic_id = (int)get_max_val(BB_TOPICS, 'topic_id'); - $max_post_id = (int)get_max_val(BB_POSTS, 'post_id'); - $max_attach_id = (int)get_max_val(BB_ATTACHMENTS, 'attach_id'); - - $torrents_count = (int)get_count(TB_TORRENTS_TABLE, 'id'); - $loops = (int)ceil($torrents_count / C_TORRENTS_PER_ONCE); - - for ($i = 0; $i < $loops; $i++) { - $start = $i * C_TORRENTS_PER_ONCE; - $offset = C_TORRENTS_PER_ONCE; - $sql = " - SELECT - id, info_hash, name, filename, search_text, descr, $_sql - category, UNIX_TIMESTAMP(added) AS added, size, views, - UNIX_TIMESTAMP(last_action) AS lastseed, times_completed, owner, sticky - FROM " . TB_TORRENTS_TABLE . " - ORDER BY id - LIMIT $start, $offset"; - - $torrents = DB()->fetch_rowset($sql); - DB()->sql_freeresult(); - - foreach ($torrents as $torrent) { - $torrent['topic_id'] = $torrent['id'] + $max_topic_id; - $torrent['post_id'] = $torrent['id'] + $max_post_id; - $torrent['attach_id'] = $torrent['id'] + $max_attach_id; - $torrent['owner'] += $max_uid; - $torrent['descr'] = append_images($torrent); - convert_torrent($torrent); - //print_r($torrent); - } - } - set_auto_increment(BB_TOPICS, 'topic_id'); - set_auto_increment(BB_POSTS, 'post_id'); - print_ok("Total $torrents_count torrents from TBDev converted"); - unset($torrents); - - if (CONVERT_COMMENTS) { - $max_post_id = (int)get_max_val(BB_POSTS, 'post_id'); - $max_topic_id = (int)get_max_val(BB_TOPICS, 'topic_id'); - $max_attach_id = (int)get_max_val(BB_ATTACHMENTS, 'attach_id'); - - $comments_count = (int)get_count(TB_COMMENTS_TABLE, 'id'); - $loops = (int)ceil($comments_count / C_COMMENTS_PER_ONCE); - - for ($i = 0; $i < $loops; $i++) { - $start = $i * C_COMMENTS_PER_ONCE; - $offset = C_COMMENTS_PER_ONCE; - $sql = " - SELECT - c.id, c.user, c.torrent, c.text, tor.category, - UNIX_TIMESTAMP(c.added) AS added, UNIX_TIMESTAMP(c.editedat) AS editedat, c.ip - FROM " . TB_COMMENTS_TABLE . " c - LEFT JOIN " . TB_TORRENTS_TABLE . " tor ON(tor.id = c.torrent) - WHERE c.torrent <> 0 - ORDER BY c.id - LIMIT $start, $offset"; - - $comments = DB()->fetch_rowset($sql); - DB()->sql_freeresult(); - - foreach ($comments as $comment) { - $comment['user'] += $max_uid; - $comment['id'] += $max_post_id; - convert_comment($comment); - } - } - unset($comments); - set_auto_increment(BB_POSTS, 'post_id'); - print_ok("Total $comments_count comments from TBDev converted"); - } - } - - ?> - -
- Converting completed. - - - \ No newline at end of file diff --git a/install/other/converter/TBDevYSE_pre6/root/converter/constants.php b/install/other/converter/TBDevYSE_pre6/root/converter/constants.php deleted file mode 100644 index e4b53187d..000000000 --- a/install/other/converter/TBDevYSE_pre6/root/converter/constants.php +++ /dev/null @@ -1,33 +0,0 @@ -" : ''; - $err = ''; - - echo '
'; - echo "OK - $sql" . str_repeat(' ', 256) . "\n
"; - echo '
'; -} - -function hex2bin($h) -{ - if (!is_string($h)) return null; - $r = ''; - for ($a = 0; $a < strlen($h); $a += 2) { - $r .= chr(hexdec($h{$a} . $h{($a + 1)})); - } - return $r; -} - -function get_max_val($table_name, $column) -{ - $row = DB()->fetch_row("SELECT MAX($column) AS $column FROM $table_name LIMIT 1"); - return $row[$column]; -} - -function get_count($table_name, $column) -{ - $row = DB()->fetch_row("SELECT COUNT($column) AS $column FROM $table_name LIMIT 1"); - return $row[$column]; -} - -function set_auto_increment($table_name, $column, $val = null) -{ - if (empty($val)) { - $row = DB()->fetch_row("SELECT MAX($column) AS val FROM $table_name LIMIT 1"); - DB()->sql_freeresult(); - $val = (int)$row['val'] + 1; - } - DB()->query("ALTER TABLE $table_name auto_increment = $val"); -} - -// Users functions -function tp_users_cleanup() -{ - DB()->query('DELETE FROM ' . BB_USERS . ' WHERE user_id NOT IN(' . EXCLUDED_USERS_CSV . ')'); - DB()->query('TRUNCATE ' . BB_BT_USERS); -} - -function tp_user_level($tb_class) -{ - switch ($tb_class) { - case 0: - case 1: - case 2: - case 3: - $level = 0; - break; - case 4: - $level = 2; - break; - case 5: - case 6: - case 7: - $level = 1; - break; - default: - $level = 0; - break; - } - return $level; -} - -function convert_user($user) -{ - $user_data = array( - "user_id" => $user['id'], - "user_active" => ($user['enabled'] == 'yes') ? true : false, - "username" => $user['username'], - "user_password" => md5($user['password']), - "user_lastvisit" => $user['last_access'], - "user_regdate" => $user['added'], - "user_level" => tp_user_level($user['class']), - "user_lang" => $user['language'], - "user_dateformat" => "Y-m-d H:i", - "user_opt" => 0, - "user_avatar" => !empty($user['avatar']) ? $user['avatar'] : null, - "user_avatar_type" => !empty($user['avatar']) ? 2 : null, - "user_email" => $user['email'], - "user_website" => $user['website'], - ); - - $columns = $values = array(); - - foreach ($user_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_USERS . " ($sql_columns) VALUES($sql_values);"); - - $bt_user_data = array( - "user_id" => $user['id'], - "auth_key" => make_rand_str(BT_AUTH_KEY_LENGTH), - "u_up_total" => $user['uploaded'], - "u_down_total" => $user['downloaded'], - ); - $columns = $values = array(); - - foreach ($bt_user_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_bt_columns = implode(',', $columns); - $sql_bt_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_BT_USERS . " ($sql_bt_columns) VALUES($sql_bt_values);"); -} - -//Torrents and categories functions -function tp_categories_cleanup() -{ - DB()->query('DELETE FROM ' . BB_CATEGORIES); -} - -function tp_add_category_old($id, $cat_title) -{ - DB()->query("INSERT IGNORE INTO " . BB_CATEGORIES . " (cat_id, cat_title) - VALUES ($id, '" . DB()->escape($cat_title) . "')"); - return; -} - -function tp_add_category($cat_data) -{ - $columns = $values = array(); - - foreach ($cat_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_bt_columns = implode(',', $columns); - $sql_bt_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_CATEGORIES . " ($sql_bt_columns) VALUES($sql_bt_values);"); -} - -function tp_topics_cleanup() -{ - DB()->query("TRUNCATE " . BB_ATTACHMENTS); - DB()->query("TRUNCATE " . BB_ATTACHMENTS_DESC); - DB()->query("TRUNCATE " . BB_BT_TORRENTS); - DB()->query("TRUNCATE " . BB_POSTS); - DB()->query("TRUNCATE " . BB_POSTS_HTML); - DB()->query("TRUNCATE " . BB_POSTS_SEARCH); - DB()->query("TRUNCATE " . BB_POSTS_TEXT); - DB()->query("TRUNCATE " . BB_TOPICS); - - return; -} - -function tp_add_topic($topic_data) -{ - $columns = $values = array(); - foreach ($topic_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_TOPICS . " ($sql_columns) VALUES($sql_values);"); - return; -} - -function tp_add_post($post_data) -{ - foreach ($post_data as $key => $data) { - $columns = $values = array(); - foreach ($data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO bb_{$key} ($sql_columns) VALUES($sql_values);"); - } - return; -} - -function tp_add_attach($attach_data) -{ - foreach ($attach_data as $key => $data) { - $columns = $values = array(); - foreach ($data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO bb_{$key} ($sql_columns) VALUES($sql_values);"); - } - return; -} - -function make_img_path($name) -{ - global $bb_cfg; - - return make_url("files/images/" . $name); -} - -function append_images($tor) -{ - $poster = $screens = ''; - switch (TR_TYPE) { - case 'yse': - if (!empty($tor['image1'])) { - $poster = "[img=right]" . make_img_path($tor['image1']) . "[/img]"; - } - if (!empty($tor['image2'])) { - $screens = '[spoiler="Скриншоты"][img]' . make_img_path($tor['image2']) . "[/img][/spoiler]"; - } - break; - case 'sky': - if (!empty($tor['poster'])) { - $poster = "[img=right]" . make_img_path($tor['poster']) . "[/img]"; - } - $has_screens = !empty($tor['screenshot1']) || !empty($tor['screenshot2']) || !empty($tor['screenshot3']) || !empty($tor['screenshot4']); - if ($has_screens) { - $screens .= '[spoiler="Скриншоты"]'; - for ($i = 1; $i <= 4; $i++) { - if (!empty($tor['screenshot' . $i])) { - $screens .= "[img]" . make_img_path($tor['screenshot' . $i]) . "[/img] \n"; - } - } - $screens .= "[/spoiler]"; - } - break; - } - return ($poster . $tor['descr'] . $screens); -} - -function convert_torrent($torrent) -{ - $topic_data = array( - "topic_id" => $torrent['topic_id'], - "forum_id" => $torrent['category'], - "topic_title" => $torrent['name'], - "topic_poster" => $torrent['owner'], - "topic_time" => $torrent['added'], - "topic_views" => $torrent['views'], - "topic_type" => ($torrent['sticky'] == 'yes') ? 1 : 0, - "topic_first_post_id" => $torrent['id'], - "topic_last_post_id" => $torrent['id'], - "topic_attachment" => 1, - "topic_dl_type" => 1, - "topic_last_post_time" => $torrent['added'], - ); - tp_add_topic($topic_data); - $post_text = stripslashes(prepare_message(addslashes(unprepare_message($torrent['descr'])), true, true)); - - $post_data = array( - "posts" => array( - "post_id" => $torrent['post_id'], - "topic_id" => $torrent['topic_id'], - "forum_id" => $torrent['category'], - "poster_id" => $torrent['owner'], - "post_time" => $torrent['added'], - "post_attachment" => 1, - ), - "posts_text" => array( - "post_id" => $torrent['post_id'], - "post_text" => $post_text, - ), - "posts_search" => array( - "post_id" => $torrent['post_id'], - "search_words" => $torrent['search_text'], - ), - ); - tp_add_post($post_data); - - $attach_data = array( - "attachments" => array( - "attach_id" => $torrent['attach_id'], - "post_id" => $torrent['post_id'], - "user_id_1" => $torrent['owner'], - ), - "attachments_desc" => array( - "attach_id" => $torrent['attach_id'], - "physical_filename" => $torrent['id'] . ".torrent", - "real_filename" => $torrent['filename'], - "extension" => "torrent", - "mimetype" => "application/x-bittorrent", - "filesize" => @filesize(get_attachments_dir() . '/' . $torrent['id'] . ".torrent"), - "filetime" => $torrent['added'], - "tracker_status" => 1, - ), - ); - tp_add_attach($attach_data); - - //Torrents - if (BDECODE) { - $filename = get_attachments_dir() . '/' . $torrent['id'] . ".torrent"; - if (!file_exists($filename)) { - return; - } - if (!function_exists('bdecode_file')) include_once(INC_DIR . 'functions_torrent.php'); - $tor = bdecode_file($filename); - $info = ($tor['info']) ? $tor['info'] : array(); - $info_hash = pack('H*', sha1(bencode($info))); - $info_hash_sql = rtrim(DB()->escape($info_hash), ' '); - } else { - $info_hash_sql = hex2bin($torrent['info_hash']); - } - - $torrent_data = array( - "info_hash" => $info_hash_sql, - "post_id" => $torrent['post_id'], - "poster_id" => $torrent['owner'], - "topic_id" => $torrent['topic_id'], - "forum_id" => $torrent['category'], - "attach_id" => $torrent['attach_id'], - "size" => $torrent['size'], - "reg_time" => $torrent['added'], - "complete_count" => $torrent['times_completed'], - "seeder_last_seen" => $torrent['lastseed'], - ); - - $columns = $values = array(); - - foreach ($torrent_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . $db->escape($value) . "'"; - } - $sql_columns = implode(', ', $columns); - $sql_values = implode(', ', $values); - - DB()->query("INSERT IGNORE INTO " . BB_BT_TORRENTS . " ($sql_columns) VALUES($sql_values);"); - return; -} - -// Comments functions -function convert_comment($comment) -{ - $post_text = prepare_message($comment['text'], true, true); - - $post_data = array( - "posts" => array( - "post_id" => $comment['id'], - "topic_id" => $comment['torrent'], - "forum_id" => $comment['category'], - "poster_id" => $comment['user'], - "post_time" => $comment['added'], - "poster_ip" => encode_ip($comment['ip']), - "post_edit_time" => $comment['editedat'], - "post_edit_count" => $comment['editedat'] ? 1 : 0, - ), - "posts_text" => array( - "post_id" => $comment['id'], - "post_text" => $post_text, - ), - ); - tp_add_post($post_data); - return; -} - -//Forums functions -function tp_forums_cleanup() -{ - DB()->query('TRUNCATE ' . BB_FORUMS); -} - -function convert_cat($forum, $allow_torrents = true) -{ - $forum_data = array( - "forum_id" => $forum['id'], - "cat_id" => $forum['cat_id'], - "forum_name" => $forum['name'], - "forum_order" => $forum['sort'], - "allow_reg_tracker" => $allow_torrents, - "allow_porno_topic" => $allow_torrents, - ); - - $columns = $values = array(); - - foreach ($forum_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_FORUMS . " ($sql_columns) VALUES($sql_values);"); - return; -} diff --git a/install/other/converter/TBDevYSE_pre6/root/converter/passwords.php b/install/other/converter/TBDevYSE_pre6/root/converter/passwords.php deleted file mode 100644 index 6f367c1be..000000000 --- a/install/other/converter/TBDevYSE_pre6/root/converter/passwords.php +++ /dev/null @@ -1,26 +0,0 @@ -session_start(); - -while (@ob_end_flush()) ; -ob_implicit_flush(); - -?> - - - - - - - - - - -
-
- -
-
- - '; - - exit; -} else { - @ini_set('memory_limit', '512M'); - @ini_set('max_execution_time', @ini_get('max_execution_time') + 1200); - - $torrents_count = (int)get_count(BB_BT_TORRENTS, 'attach_id'); - $loops = (int)ceil($torrents_count / C_TORRENTS_PER_ONCE); - - $not_exist = array(); - - $attach_dir = get_attachments_dir() . '/'; - - for ($i = 0; $i < $loops; $i++) { - $start = $i * C_TORRENTS_PER_ONCE; - $offset = C_TORRENTS_PER_ONCE; - - $sql = "SELECT - tor.attach_id, tor.topic_id, ad.physical_filename - FROM " . BB_BT_TORRENTS . " tor - LEFT JOIN " . BB_ATTACHMENTS_DESC . " ad ON(ad.attach_id = tor.attach_id) - ORDER BY tor.attach_id - LIMIT $start, $offset"; - - $torrents = DB()->fetch_rowset($sql); - DB()->sql_freeresult(); - - foreach ($torrents as $torrent) { - $filename = $attach_dir . $torrent['physical_filename']; - if (!file_exists($filename)) { - $not_exist[] = '' . $filename . ''; - } else { - $tor = bdecode_file($filename); - $info = (!empty($tor['info'])) ? $tor['info'] : array(); - $info_hash = pack('H*', sha1(bencode($info))); - $info_hash_sql = rtrim(DB()->escape($info_hash), ' '); - - DB()->query("UPDATE " . BB_BT_TORRENTS . " - SET info_hash = '$info_hash_sql' - WHERE attach_id = {$torrent['attach_id']}"); - } - } - } - - print_ok("Completed"); - - if (!empty($not_exist)) { - print_ok("These torrents doesn't exist in filesystem: " . implode(', ', array_unique($not_exist))); - } -} diff --git a/install/other/recover/converter/constants.php b/install/other/recover/converter/constants.php deleted file mode 100644 index e4b53187d..000000000 --- a/install/other/recover/converter/constants.php +++ /dev/null @@ -1,33 +0,0 @@ -" : ''; - $err = ''; - - echo '
'; - echo "OK - $sql" . str_repeat(' ', 256) . "\n
"; - echo '
'; -} - -function hex2bin($h) -{ - if (!is_string($h)) return null; - $r = ''; - for ($a = 0; $a < strlen($h); $a += 2) { - $r .= chr(hexdec($h{$a} . $h{($a + 1)})); - } - return $r; -} - -function get_max_val($table_name, $column) -{ - $row = DB()->fetch_row("SELECT MAX($column) AS $column FROM $table_name LIMIT 1"); - return $row[$column]; -} - -function get_count($table_name, $column) -{ - $row = DB()->fetch_row("SELECT COUNT($column) AS $column FROM $table_name LIMIT 1"); - return $row[$column]; -} - -function set_auto_increment($table_name, $column, $val = null) -{ - if (empty($val)) { - $row = DB()->fetch_row("SELECT MAX($column) AS val FROM $table_name LIMIT 1"); - DB()->sql_freeresult(); - $val = (int)$row['val'] + 1; - } - DB()->query("ALTER TABLE $table_name auto_increment = $val"); -} - -//Users functions -function tp_users_cleanup() -{ - DB()->query('DELETE FROM ' . BB_USERS . ' WHERE user_id NOT IN(' . EXCLUDED_USERS_CSV . ')'); - DB()->query('TRUNCATE ' . BB_BT_USERS); -} - -function tp_user_level($tb_class) -{ - switch ($tb_class) { - case 0: - case 1: - case 2: - case 3: - $level = 0; - break; - case 4: - $level = 2; - break; - case 5: - case 6: - case 7: - $level = 1; - break; - default: - $level = 0; - break; - } - return $level; -} - -function convert_user($user) -{ - $user_data = array( - "user_id" => $user['id'], - "user_active" => ($user['enabled'] == 'yes') ? true : false, - "username" => $user['username'], - "user_password" => md5($user['password']), - "user_lastvisit" => $user['last_access'], - "user_regdate" => $user['added'], - "user_level" => tp_user_level($user['class']), - "user_lang" => $user['language'], - "user_dateformat" => "Y-m-d H:i", - "user_opt" => $user['opt'], // Added - "user_avatar" => !empty($user['avatar']) ? $user['avatar'] : null, - "user_avatar_type" => !empty($user['avatar']) ? 2 : null, - "user_email" => $user['email'], - "user_website" => $user['website'], - "user_icq" => $user['icq'], - "user_skype" => $user['skype'], - "user_twitter" => $user['twitter'], - "user_gender" => $user['gender'], - "user_birthday" => $user['user_birthday'], - ); - - $columns = $values = array(); - - foreach ($user_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_USERS . " ($sql_columns) VALUES ($sql_values);"); - - $bt_user_data = array( - "user_id" => $user['id'], - "auth_key" => make_rand_str(BT_AUTH_KEY_LENGTH), - "u_up_total" => $user['uploaded'], - "u_down_total" => $user['downloaded'], - ); - $columns = $values = array(); - - foreach ($bt_user_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_bt_columns = implode(',', $columns); - $sql_bt_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_BT_USERS . " ($sql_bt_columns) VALUES ($sql_bt_values);"); -} - -//Torrents and categories functions -function tp_categories_cleanup() -{ - DB()->query('DELETE FROM ' . BB_CATEGORIES); -} - -function tp_add_category_old($id, $cat_title) -{ - DB()->query("INSERT IGNORE INTO " . BB_CATEGORIES . " (cat_id, cat_title) - VALUES ($id, '" . DB()->escape($cat_title) . "')"); - return; -} - -function tp_add_category($cat_data) -{ - $columns = $values = array(); - - foreach ($cat_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_bt_columns = implode(',', $columns); - $sql_bt_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_CATEGORIES . " ($sql_bt_columns) VALUES ($sql_bt_values);"); -} - -function tp_topics_cleanup() -{ - DB()->query("TRUNCATE " . BB_ATTACHMENTS); - DB()->query("TRUNCATE " . BB_ATTACHMENTS_DESC); - DB()->query("TRUNCATE " . BB_BT_TORRENTS); - DB()->query("TRUNCATE " . BB_POSTS); - DB()->query("TRUNCATE " . BB_POSTS_HTML); - DB()->query("TRUNCATE " . BB_POSTS_SEARCH); - DB()->query("TRUNCATE " . BB_POSTS_TEXT); - DB()->query("TRUNCATE " . BB_TOPICS); - - return; -} - -function tp_add_topic($topic_data) -{ - $columns = $values = array(); - foreach ($topic_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_TOPICS . " ($sql_columns) VALUES ($sql_values);"); - return; -} - -function tp_add_post($post_data) -{ - foreach ($post_data as $key => $data) { - $columns = $values = array(); - foreach ($data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO bb_{$key} ($sql_columns) VALUES ($sql_values);"); - } - return; -} - -function tp_add_attach($attach_data) -{ - foreach ($attach_data as $key => $data) { - $columns = $values = array(); - foreach ($data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO bb_{$key} ($sql_columns) VALUES ($sql_values);"); - } - return; -} - -function make_img_path($name) -{ - global $bb_cfg; - - return make_url("files/images/" . $name); -} - -function append_images($tor) -{ - $poster = $screens = ''; - switch (TR_TYPE) { - case 'yse': - if (!empty($tor['image1'])) { - $poster = "[img=right]" . make_img_path($tor['image1']) . "[/img]"; - } - if (!empty($tor['image2'])) { - $screens = '[spoiler="Скриншоты"][img]' . make_img_path($tor['image2']) . "[/img][/spoiler]"; - } - break; - case 'sky': - if (!empty($tor['poster'])) { - $poster = "[img=right]" . make_img_path($tor['poster']) . "[/img]"; - } - $has_screens = !empty($tor['screenshot1']) || !empty($tor['screenshot2']) || !empty($tor['screenshot3']) || !empty($tor['screenshot4']); - if ($has_screens) { - $screens .= '[spoiler="Скриншоты"]'; - for ($i = 1; $i <= 4; $i++) { - if (!empty($tor['screenshot' . $i])) { - $screens .= "[img]" . make_img_path($tor['screenshot' . $i]) . "[/img] \n"; - } - } - $screens .= "[/spoiler]"; - } - break; - } - return ($poster . $tor['descr'] . $screens); -} - -function convert_torrent($torrent) -{ - $topic_data = array( - "topic_id" => $torrent['topic_id'], - "forum_id" => $torrent['category'], - "topic_title" => $torrent['name'], - "topic_poster" => $torrent['owner'], - "topic_time" => $torrent['added'], - "topic_views" => $torrent['views'], - "topic_type" => ($torrent['sticky'] == 'yes') ? 1 : 0, - "topic_first_post_id" => $torrent['id'], - "topic_last_post_id" => $torrent['id'], - "topic_attachment" => 1, - "topic_dl_type" => 1, - "topic_last_post_time" => $torrent['added'], - ); - tp_add_topic($topic_data); - - $post_text = stripslashes(prepare_message(addslashes(unprepare_message($torrent['descr'])), true, true)); - - $post_data = array( - "posts" => array( - "post_id" => $torrent['post_id'], - "topic_id" => $torrent['topic_id'], - "forum_id" => $torrent['category'], - "poster_id" => $torrent['owner'], - "post_time" => $torrent['added'], - "post_attachment" => 1, - ), - "posts_text" => array( - "post_id" => $torrent['post_id'], - "post_text" => $post_text, - ), - "posts_search" => array( - "post_id" => $torrent['post_id'], - "search_words" => $torrent['search_text'], - ), - ); - tp_add_post($post_data); - - $attach_data = array( - "attachments" => array( - "attach_id" => $torrent['attach_id'], - "post_id" => $torrent['post_id'], - "user_id_1" => $torrent['owner'], - ), - "attachments_desc" => array( - "attach_id" => $torrent['attach_id'], - "physical_filename" => $torrent['id'] . ".torrent", - "real_filename" => $torrent['filename'], - "extension" => "torrent", - "mimetype" => "application/x-bittorrent", - "filesize" => @filesize(get_attachments_dir() . '/' . $torrent['id'] . ".torrent"), - "filetime" => $torrent['added'], - "tracker_status" => 1, - ), - ); - tp_add_attach($attach_data); - - //Torrents - if (BDECODE) { - $filename = get_attachments_dir() . '/' . $torrent['id'] . ".torrent"; - if (!file_exists($filename)) { - return; - } - if (!function_exists('bdecode_file')) include_once('./includes/functions_torrent.php'); - $tor = bdecode_file($filename); - $info = ($tor['info']) ? $tor['info'] : array(); - $info_hash = pack('H*', sha1(bencode($info))); - $info_hash_sql = rtrim(DB()->escape($info_hash), ' '); - } else { - $info_hash_sql = hex2bin($torrent['info_hash']); - } - - $torrent_data = array( - "info_hash" => $info_hash_sql, - "post_id" => $torrent['post_id'], - "poster_id" => $torrent['owner'], - "topic_id" => $torrent['topic_id'], - "forum_id" => $torrent['category'], - "attach_id" => $torrent['attach_id'], - "size" => $torrent['size'], - "reg_time" => $torrent['added'], - "complete_count" => $torrent['times_completed'], - "seeder_last_seen" => $torrent['lastseed'], - ); - - $columns = $values = array(); - - foreach ($torrent_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(', ', $columns); - $sql_values = implode(', ', $values); - - DB()->query("INSERT IGNORE INTO " . BB_BT_TORRENTS . " ($sql_columns) VALUES($sql_values);"); - return; -} - -//Comments functions -function convert_comment($comment) -{ - $post_text = prepare_message($comment['text'], true, true); - - $post_data = array( - "posts" => array( - "post_id" => $comment['id'], - "topic_id" => $comment['torrent'], - "forum_id" => $comment['category'], - "poster_id" => $comment['user'], - "post_time" => $comment['added'], - "poster_ip" => encode_ip($comment['ip']), - "post_edit_time" => $comment['editedat'], - "post_edit_count" => $comment['editedat'] ? 1 : 0, - ), - "posts_text" => array( - "post_id" => $comment['id'], - "post_text" => $post_text, - ), - ); - tp_add_post($post_data); - return; -} - -//Forums functions -function tp_forums_cleanup() -{ - DB()->query('TRUNCATE ' . BB_FORUMS); -} - -function convert_cat($forum, $allow_torrents = true) -{ - $forum_data = array( - "forum_id" => $forum['id'], - "cat_id" => $forum['cat_id'], - "forum_name" => $forum['name'], - "forum_order" => $forum['sort'], - "allow_reg_tracker" => $allow_torrents, - "allow_dl_topic" => $allow_torrents, - ); - - $columns = $values = array(); - - foreach ($forum_data as $column => $value) { - $columns[] = $column; - $values[] = "'" . DB()->escape($value) . "'"; - } - $sql_columns = implode(',', $columns); - $sql_values = implode(',', $values); - - DB()->query("INSERT IGNORE INTO " . BB_FORUMS . " ($sql_columns) VALUES ($sql_values);"); - return; -} \ No newline at end of file diff --git a/install/other/recover/converter/passwords.php b/install/other/recover/converter/passwords.php deleted file mode 100644 index 6f367c1be..000000000 --- a/install/other/recover/converter/passwords.php +++ /dev/null @@ -1,26 +0,0 @@ -session_start(); - -while (@ob_end_flush()) ; -ob_implicit_flush(); - -?> - - - - - - - - - -
-
- -
-
- - '; - - exit; -} else { - @ini_set('memory_limit', '512M'); - @ini_set('max_execution_time', @ini_get('max_execution_time') + 1200); - - $torrents_count = (int)get_count(BB_BT_TORRENTS, 'attach_id'); - $loops = (int)ceil($torrents_count / C_TORRENTS_PER_ONCE); - - $not_exist = array(); - - $attach_dir = get_attachments_dir() . '/'; - - for ($i = 0; $i < $loops; $i++) { - $start = $i * C_TORRENTS_PER_ONCE; - $offset = C_TORRENTS_PER_ONCE; - - $sql = "SELECT - tor.attach_id, tor.topic_id, ad.physical_filename - FROM " . BB_BT_TORRENTS . " tor - LEFT JOIN " . BB_ATTACHMENTS_DESC . " ad ON(ad.attach_id = tor.attach_id) - ORDER BY tor.attach_id - LIMIT $start, $offset"; - - $torrents = DB()->fetch_rowset($sql); - DB()->sql_freeresult(); - - foreach ($torrents as $torrent) { - $filename = $attach_dir . $torrent['physical_filename']; - if (!file_exists($filename)) { - $not_exist[] = '' . $filename . ''; - } else { - $tor = bdecode_file($filename); - $info = (!empty($tor['info'])) ? $tor['info'] : array(); - $info_hash = pack('H*', sha1(bencode($info))); - $info_hash_sql = rtrim(DB()->escape($info_hash), ' '); - - DB()->query("UPDATE " . BB_BT_TORRENTS . " - SET info_hash = '$info_hash_sql' - WHERE attach_id = {$torrent['attach_id']}"); - } - } - } - - print_ok("Completed"); - - if (!empty($not_exist)) { - print_ok("These torrents doesn't exist in filesystem: " . implode(', ', array_unique($not_exist))); - } -} diff --git a/install/php-fpm+nginx/bash.txt b/install/php-fpm+nginx/bash.txt deleted file mode 100644 index 0cb7a314b..000000000 --- a/install/php-fpm+nginx/bash.txt +++ /dev/null @@ -1,5 +0,0 @@ -$ mkdir /tmp/nginx -$ mkdir /tmp/nginx/fastcgi_temp -$ mkdir /tmp/nginx/client_temp - -$ mkdir /var/log/nginx/ \ No newline at end of file diff --git a/install/php-fpm+nginx/fastcgi_params b/install/php-fpm+nginx/fastcgi_params deleted file mode 100644 index 425b73424..000000000 --- a/install/php-fpm+nginx/fastcgi_params +++ /dev/null @@ -1,31 +0,0 @@ -fastcgi_connect_timeout 60; -fastcgi_send_timeout 180; -fastcgi_read_timeout 180; -fastcgi_buffer_size 32k; -fastcgi_buffers 4 32k; -fastcgi_busy_buffers_size 32k; -fastcgi_temp_file_write_size 32k; -fastcgi_temp_path /tmp/nginx/fastcgi_temp 1 2; - -fastcgi_param QUERY_STRING $query_string; -fastcgi_param REQUEST_METHOD $request_method; -fastcgi_param CONTENT_TYPE $content_type; -fastcgi_param CONTENT_LENGTH $content_length; - -fastcgi_param SCRIPT_NAME $fastcgi_script_name; -fastcgi_param REQUEST_URI $request_uri; -fastcgi_param DOCUMENT_URI $document_uri; -fastcgi_param DOCUMENT_ROOT $document_root; -fastcgi_param SERVER_PROTOCOL $server_protocol; - -fastcgi_param GATEWAY_INTERFACE CGI/1.1; -fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - -fastcgi_param REMOTE_ADDR $remote_addr; -fastcgi_param REMOTE_PORT $remote_port; -fastcgi_param SERVER_ADDR $server_addr; -fastcgi_param SERVER_PORT $server_port; -fastcgi_param SERVER_NAME $server_name; - -# PHP only, required if PHP was built with --enable-force-cgi-redirect -fastcgi_param REDIRECT_STATUS 200; \ No newline at end of file diff --git a/install/php-fpm+nginx/nginx.conf b/install/php-fpm+nginx/nginx.conf deleted file mode 100644 index 1e24a39a0..000000000 --- a/install/php-fpm+nginx/nginx.conf +++ /dev/null @@ -1,154 +0,0 @@ -user www www; -worker_processes auto; - -#error_log /var/log/nginx/error.log; -#error_log /var/log/nginx/error.log notice; -#error_log /var/log/nginx/error.log info; - -pid /var/run/nginx.pid; - -worker_rlimit_nofile 1024; -events { - worker_connections 1024; -} - -http { - include mime.types; - default_type application/octet-stream; - - #log_format main '$remote_addr - $remote_user [$time_local] $request ' - # '"$status" $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; - - #log_format IP .$remote_addr.; - - access_log off; - - server_tokens off; - reset_timedout_connection on; - - sendfile on; - - # http://en.wikipedia.org/wiki/Asynchronous_I/O - # aio sendfile; - - output_buffers 1 64k; - - tcp_nopush on; - tcp_nodelay on; - send_lowat 12000; - log_not_found off; - - keepalive_timeout 65; - - limit_req_zone $binary_remote_addr zone=one:16m rate=5r/s; - - gzip on; - gzip_vary on; - gzip_min_length 2048; - gzip_comp_level 5; - gzip_http_version 1.0; - gzip_proxied any; - gzip_disable "msie6"; - gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; - - client_max_body_size 10m; - large_client_header_buffers 4 8k; - client_body_temp_path /tmp/nginx/client_temp 1 2; - - server { - #listen 80 default sndbuf=32k rcvbuf=8k accept_filter=httpready; - #listen [::]:80 default sndbuf=32k rcvbuf=8k accept_filter=httpready; - - listen 80 default sndbuf=32k rcvbuf=8k; - server_name sitedomain.ru; - - charset utf8; - - access_log off; - - location / { - root /var/www; - index index.php index.html index.htm; - } - - error_page 404 /404.html; - error_page 500 502 503 504 /50x.html; - - # pass the PHP scripts to FastCGI server listening on /tmp/php.sock - location ~ \.php$ { - #limit_req zone=one burst=20 nodelay; - #limit_req_log_level info; - - root /var/www; - fastcgi_index index.php; - fastcgi_pass unix:/tmp/php.sock; # 127.0.0.1:9000; - fastcgi_intercept_errors on; - - # FreeBSD Optimization - fastcgi_pass_request_body off; - client_body_in_file_only clean; - fastcgi_param REQUEST_BODY_FILE $request_body_file; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; - - include fastcgi_params; - } - - # rewrite to XBTT (old) -# location ^~ /bt/ { -# access_log off; -# if ( $query_string ~ "^uk=([^&?]{10})[&?]+(.*)$" ) { -# set $uk $1; -# set $qs $2&ip=$remote_addr; -# } -# if ( $query_string ~ "^uk=([^&?]{10})[&?]+((.*&|)ip=.*)$" ) { -# set $uk $1; -# set $qs $2; -# } -# if ( $qs ) { -# rewrite ^.*/([a-z]+)(\.php|)$ /$uk/$1?$qs break; -# } -# rewrite ^/?(.*)$ /$1?ip=$remote_addr&$query_string break; -# proxy_pass http://127.0.0.1:2710/; -# } - - # cache static files - location ~* \.(jpg|jpeg|gif|png|css|js|ico)$ { - root /var/www; - access_log off; - expires 30d; - add_header Cache-Control public; - } - - # sitemap rewrite - rewrite ^/sitemap.xml$ /internal_data/sitemap/sitemap.xml; - - # deny access to admin folder - location ~ \/admin|backup\/ { - deny all; - #allow YOUR_IP; - } - - # deny access to system folder - location ~ \/(install|internal_data|library)\/ { - deny all; - } - - # deny access to git folder - location ~ /\.git { - deny all; - } - - # deny access to .htaccess, if apache's document root concurs with nginx's one - location ~ /\.ht { - deny all; - } - - # deny access to critical files - location ~ \.(.*sql|tpl|db|inc|log|md)$ { - deny all; - } - } -} \ No newline at end of file diff --git a/install/sphinx/sphinx.conf b/install/sphinx/sphinx.conf deleted file mode 100644 index d29033d81..000000000 --- a/install/sphinx/sphinx.conf +++ /dev/null @@ -1,104 +0,0 @@ -source torrentpier -{ - type = mysql - sql_host = localhost - sql_user = user - sql_pass = pass - sql_db = dbase - sql_query_pre = SET NAMES utf8 - sql_query_pre = SET CHARACTER_SET_RESULTS=utf8 - sql_query_pre = SET CHARACTER_SET_CLIENT=utf8 -} - -source topics: torrentpier -{ - sql_query = \ - SELECT topic_id, forum_id, topic_title \ - FROM bb_topics \ - WHERE topic_id BETWEEN $start AND $end - - sql_query_range = SELECT MIN(topic_id), MAX(topic_id) FROM bb_topics - sql_range_step = 100000 - - sql_attr_uint = forum_id - sql_ranged_throttle = 50 - sql_query_info = SELECT * FROM bb_topics WHERE topic_id = $id -} - -source posts: torrentpier -{ - sql_query = \ - SELECT pt.post_id, pt.post_text, t.topic_title, t.topic_id, t.forum_id \ - FROM bb_posts_text pt \ - LEFT JOIN bb_topics t on pt.post_id = t.topic_first_post_id \ - WHERE pt.post_id BETWEEN $start AND $end - - sql_query_range = SELECT MIN(post_id), MAX(post_id) FROM bb_posts_text - sql_range_step = 100000 - - sql_attr_uint = topic_id - sql_attr_uint = forum_id - sql_ranged_throttle = 50 - sql_query_info = SELECT * FROM bb_posts_text WHERE post_id = $id -} - -source users: torrentpier -{ - sql_query = \ - SELECT user_id, username \ - FROM bb_users \ - WHERE user_id BETWEEN $start AND $end - - sql_query_range = SELECT 1, MAX(user_id) FROM bb_users - sql_range_step = 1000 - sql_query_info = SELECT * FROM bb_users WHERE user_id = $id -} - -index topics -{ - docinfo = extern - morphology = stem_enru - charset_type = utf-8 - charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42C->U+430..U+44C, U+42E..U+42F->U+44E..U+44F, U+430..U+44C, U+44E..U+44F, U+0401->U+0435, U+0451->U+0435, U+042D->U+0435, U+044D->U+0435 - min_prefix_len = 0 - min_infix_len = 0 - min_word_len = 1 - min_stemming_len = 4 - enable_star = 1 - phrase_boundary = :, - , . , $ - phrase_boundary_step = 1 - html_strip = 1 - path = ./sphinx/data/topics - source = topics -} - -index posts: topics -{ - path = ./sphinx/data/posts - source = posts -} - -index users: topics -{ - path = ./sphinx/data/users - source = users -} - -indexer -{ - mem_limit = 256M -} - -searchd -{ - listen = 127.0.0.1:3312 - log = ./sphinx/log/searchd.log - query_log = ./sphinx/log/query.log - read_timeout = 5 - max_children = 15 - max_matches = 5000 - seamless_rotate = 1 - preopen_indexes = 0 - unlink_old = 1 - pid_file = ./sphinx/searchd.pid -} \ No newline at end of file diff --git a/robots.txt b/robots.txt index 033673ab4..9944263bb 100644 --- a/robots.txt +++ b/robots.txt @@ -1,4 +1,5 @@ User-agent: * +Disallow: /bt/* Disallow: /dl.php Disallow: /group.php Disallow: /login.php @@ -9,4 +10,4 @@ Disallow: /privmsg.php Disallow: /profile.php Host: torrentpier.me -Sitemap: http://torrentpier.me/sitemap.xml \ No newline at end of file +Sitemap: http://torrentpier.me/sitemap.xml