Реформат в PSR-2 + добавление заголовков лицензии MIT в файлы

This commit is contained in:
Yuriy Pikhtarev 2017-01-13 01:20:43 +03:00
commit 3730bed000
No known key found for this signature in database
GPG key ID: 3A9B5A757B48ECC6
207 changed files with 44327 additions and 43119 deletions

View file

@ -1,34 +1,55 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// TorrentPier bridge
define ('TP_ROOT', './../ptv/'); // Absolete or related local path to your TorrentPier installation
define ('USER_ID_DIFF', 1); // User_id difference between TP and TBDev (tp_user_id - tb_user_id)
define('TP_ROOT', './../ptv/'); // Absolete or related local path to your TorrentPier installation
define('USER_ID_DIFF', 1); // User_id difference between TP and TBDev (tp_user_id - tb_user_id)
// TorrentPier Database
$dbhost = 'localhost';
$dbname = 'dbase';
$dbuser = 'user';
$dbpasswd = 'pass';
$dbpasswd = 'pass';
$dbcharset = 'utf8';
// Start announce
define ('IN_ANNOUNCE', true);
define('IN_ANNOUNCE', true);
require_once('./include/core_announce.php');
$passkey = @$_GET['passkey'];
if (!$passkey)
{
err('Passkey required');
if (!$passkey) {
err('Passkey required');
}
dbconn();
$res = mysql_query("SELECT id FROM users WHERE passkey = " . sqlesc($passkey)) or err(mysql_error());
if (mysql_affected_rows() == 0)
{
err('Invalid passkey! Re-download the .torrent from '.$DEFAULTBASEURL);
if (mysql_affected_rows() == 0) {
err('Invalid passkey! Re-download the .torrent from ' . $DEFAULTBASEURL);
}
$user = mysql_fetch_array($res);
@ -45,9 +66,8 @@ mysql_query("SET NAMES $dbcharset");
$user_id += USER_ID_DIFF;
$res = mysql_query("SELECT auth_key FROM bb_bt_users WHERE user_id = $user_id") or err(mysql_error());
if (mysql_affected_rows() == 0)
{
err('Passkey doesn\'t created on new tracker or user doesn\'t exist');
if (mysql_affected_rows() == 0) {
err('Passkey doesn\'t created on new tracker or user doesn\'t exist');
}
$user = mysql_fetch_array($res);
@ -58,5 +78,5 @@ $_GET['uk'] = $user['auth_key'];
unset($res, $user, $dbpasswd, $passkey, $user_id);
// Execute TP's announce
chdir(TP_ROOT .'bt/');
chdir(TP_ROOT . 'bt/');
require('announce.php');

View file

@ -1,4 +1,27 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
require_once("include/bittorrent.php");
@ -8,37 +31,35 @@ loggedinorreturn();
$new_tr_url = "http://torrentpier.me/"; // with ending slash
$subject = "Переезд на новый движок";
$msg = '[b]Внимание![/b] Наш трекер переехал на новый движок! Адрес трекера - [url='.$new_tr_url.']'.$new_tr_url.'[/url]
$msg = '[b]Внимание![/b] Наш трекер переехал на новый движок! Адрес трекера - [url=' . $new_tr_url . ']' . $new_tr_url . '[/url]
Вся база перенесена на новый движок, регистрироваться заново не надо.
Войти на трекер можно [url='.$new_tr_url.'login.php]здесь[/url]. Ваши данные на новом трекере:
Войти на трекер можно [url=' . $new_tr_url . 'login.php]здесь[/url]. Ваши данные на новом трекере:
[b]Логин:[/b] %s
[b]Пароль:[/b] %s
Сменить пароль можно после входа на трекер в [url='.$new_tr_url.'profile.php?mode=editprofile]настройках[/url].';
Сменить пароль можно после входа на трекер в [url=' . $new_tr_url . 'profile.php?mode=editprofile]настройках[/url].';
if (empty($_POST['confirm']))
{
stdhead();
echo '
if (empty($_POST['confirm'])) {
stdhead();
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
<input type="submit" name="confirm" value="Start mass PM" />
</form>
</center>
';
}
else
{
if (!file_exists('passwords.php')) stderr($tracker_lang['error'], 'passwords.php not exists');
} 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');
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();
stdfoot();

View file

@ -1,8 +1,31 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define ('IN_FORUM', true);
define ('BB_ROOT', './');
require (BB_ROOT .'common.php');
define('IN_FORUM', true);
define('BB_ROOT', './');
require(BB_ROOT . 'common.php');
require(BB_ROOT . 'converter/constants.php');
require(BB_ROOT . 'converter/settings.php');
require(BB_ROOT . 'converter/functions.php');
@ -10,252 +33,237 @@ require(BB_ROOT . 'converter/functions.php');
// Start session management
$user->session_start();
if (!IS_ADMIN) die("Restricted access");
while (@ob_end_flush());
if (!IS_ADMIN) {
die("Restricted access");
}
while (@ob_end_flush()) ;
ob_implicit_flush();
error_reporting(E_ALL);
@ini_set('display_errors', 1);
?>
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
</head>
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
</head>
<body style="font: 12px Courier, monospace; white-space: nowrap;">
<?php
if (empty($_POST['confirm']))
{
echo '
if (empty($_POST['confirm'])) {
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
<input type="submit" name="confirm" value="Start convert" />
</form>
</center>
</body>
';
exit;
}
else
{
@ini_set('memory_limit', '512M');
@ini_set('max_execution_time', @ini_get('max_execution_time') + 1200);
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");
}
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;
$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();
$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;
switch (TR_TYPE) {
case 'yse':
$_sql = 'avatar, ';
break;
default:
$_sql = '';
break;
}
default:
$_sql = '';
break;
}
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_USERS_PER_ONCE;
$offset = C_USERS_PER_ONCE;
for ($i = 0; $i < $loops; $i++) {
$start = $i * C_USERS_PER_ONCE;
$offset = C_USERS_PER_ONCE;
$sql = "
$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 ."
FROM " . TB_USERS_TABLE . "
ORDER BY id
LIMIT $start, $offset";
$users = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
$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 = "<?php \n";
$to_write .= '$passwords = '. var_export($pass, true) .';';
fwrite($passf, $to_write);
fclose($passf);
set_auto_increment(BB_USERS, 'user_id');
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 = "<?php \n";
$to_write .= '$passwords = ' . var_export($pass, true) . ';';
fwrite($passf, $to_write);
fclose($passf);
set_auto_increment(BB_USERS, 'user_id');
print_ok ("Total $users_count users from TBDev converted");
unset($users, $pass, $to_write);
}
print_ok("Total $users_count users from TBDev converted");
unset($users, $pass, $to_write);
}
if (CONVERT_TORRENTS)
{
require_once(INC_DIR .'functions_post.php');
require_once(INC_DIR .'bbcode.php');
if (CONVERT_TORRENTS) {
require_once(INC_DIR . 'functions_post.php');
require_once(INC_DIR . 'bbcode.php');
if (CLEAN)
{
tp_categories_cleanup();
tp_forums_cleanup();
tp_topics_cleanup();
print_ok ("Categories, forums and topics cleared");
}
if (CLEAN) {
tp_categories_cleanup();
tp_forums_cleanup();
tp_topics_cleanup();
print_ok("Categories, forums and topics cleared");
}
$max_uid = !empty($max_uid) ? $max_uid : 1;
$max_uid = !empty($max_uid) ? $max_uid : 1;
//Create a category for torrents
$max_cat_id = (int) get_max_val(BB_CATEGORIES, 'cat_id');
$tr_cat_id = $max_cat_id + 1;
//Create a category for torrents
$max_cat_id = (int)get_max_val(BB_CATEGORIES, 'cat_id');
$tr_cat_id = $max_cat_id + 1;
$tp_cat_data = array(
"cat_id" => $tr_cat_id,
"cat_title" => 'Tracker',
);
tp_add_category($tp_cat_data);
set_auto_increment(BB_CATEGORIES, 'cat_id');
unset($tp_cat_data);
$tp_cat_data = array(
"cat_id" => $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();
$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');
$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);
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;
// Start of torrents converting
switch (TR_TYPE) {
case 'yse':
$_sql = 'image1, image2, ';
break;
case 'sky':
$_sql = 'poster, screenshot1, screenshot2, screenshot3, screenshot4, ';
break;
case 'sky':
$_sql = 'poster, screenshot1, screenshot2, screenshot3, screenshot4, ';
break;
default:
$_sql = '';
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');
$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);
$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 = "
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 ."
FROM " . TB_TORRENTS_TABLE . "
ORDER BY id
LIMIT $start, $offset";
$torrents = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
$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);
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');
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);
$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 = "
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)
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();
$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");
}
}
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");
}
}
?>
</div>
<br />
Converting completed.
</body>
</html>
<?php } ?>
?>
</div>
<br/>
Converting completed.
</body>
</html>
<?php
} ?>

View file

@ -1,8 +1,33 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
if (!defined('EXCLUDED_USERS_CSV')) { define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,))); }
define('TB_USERS_TABLE', 'users');
if (!defined('EXCLUDED_USERS_CSV')) {
define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,)));
}
define('TB_USERS_TABLE', 'users');
define('TB_CATEGORIES_TABLE', 'categories');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
define('MYBB_FORUMS_TABLE', 'mybb_forums');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
define('MYBB_FORUMS_TABLE', 'mybb_forums');

View file

@ -1,424 +1,426 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
function print_ok ($sql)
function print_ok($sql)
{
global $err;
global $err;
echo ($err) ? "\n<br />" : '';
$err = '';
echo ($err) ? "\n<br />" : '';
$err = '';
echo '<div>';
echo "<font color=darkgreen><b>OK</b> - $sql</font>". str_repeat(' ', 256) ."\n<br />";
echo '</div>';
echo '<div>';
echo "<font color=darkgreen><b>OK</b> - $sql</font>" . str_repeat(' ', 256) . "\n<br />";
echo '</div>';
}
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;
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];
$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];
$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");
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);
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;
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'],
);
$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();
$columns = $values = array();
foreach ($user_data as $column => $value)
{
$columns[] = $column;
$values[] = "'". DB()->escape($value) ."'";
}
$sql_columns = implode(',', $columns);
$sql_values = implode(',', $values);
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);");
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();
$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);
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);");
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);
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;
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();
$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);
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);");
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);
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;
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);
$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;
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);
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;
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);
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;
DB()->query("INSERT IGNORE INTO bb_{$key} ($sql_columns) VALUES($sql_values);");
}
return;
}
function make_img_path ($name)
function make_img_path($name)
{
global $bb_cfg;
global $bb_cfg;
return make_url("files/images/" . $name);
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);
$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));
$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);
$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);
$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']);
}
//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'],
);
$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();
$columns = $values = array();
foreach ($torrent_data as $column => $value)
{
$columns[] = $column;
$values[] = "'". $db->escape($value) ."'";
}
$sql_columns = implode(', ', $columns);
$sql_values = implode(', ', $values);
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;
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_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;
$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);
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,
);
$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();
$columns = $values = array();
foreach ($forum_data as $column => $value)
{
$columns[] = $column;
$values[] = "'". DB()->escape($value) ."'";
}
$sql_columns = implode(',', $columns);
$sql_values = implode(',', $values);
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;
DB()->query("INSERT IGNORE INTO " . BB_FORUMS . " ($sql_columns) VALUES($sql_values);");
return;
}

View file

@ -1,3 +1,26 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
$passwords = array();
$passwords = array();

View file

@ -1,18 +1,42 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// Tracker type
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
// Options
define('CLEAN', true); // Clean TorrentPier's database before converting?
define('CLEAN', true); // Clean TorrentPier's database before converting?
//Users
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
//Torrents and categories
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('C_TORRENTS_PER_ONCE', 400); // Number of torrents converting per once
define('BDECODE', false); // Recalculate info_hash using bdecode?
define('BDECODE', false); // Recalculate info_hash using bdecode?
//Comments
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('C_COMMENTS_PER_ONCE', 400); // Number of comments converting per once
//Mybb forums & topics
define('CONVERT_MYBB_FORUMS', false); // Converting forums is enabled?
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once

View file

@ -1,98 +1,110 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
require(BB_ROOT .'common.php');
require(INC_DIR .'functions_torrent.php');
require(BB_ROOT . 'common.php');
require(INC_DIR . 'functions_torrent.php');
require(BB_ROOT . 'converter/settings.php');
require(BB_ROOT . 'converter/functions.php');
// Init userdata
$user->session_start();
while (@ob_end_flush());
while (@ob_end_flush()) ;
ob_implicit_flush();
?>
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
</head>
<body style="font: 12px Courier, monospace; white-space: nowrap;">
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
</head>
<body style="font: 12px Courier, monospace; white-space: nowrap;">
<?php
if (empty($_POST['confirm']))
{
echo '
if (empty($_POST['confirm'])) {
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
<input type="submit" name="confirm" value="Recover" />
</form>
</center>
</body>
';
exit;
}
else
{
exit;
} else {
@ini_set('memory_limit', '512M');
@ini_set('max_execution_time', @ini_get('max_execution_time') + 1200);
@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);
$torrents_count = (int) get_count(BB_BT_TORRENTS, 'attach_id');
$loops = (int) ceil($torrents_count / C_TORRENTS_PER_ONCE);
$not_exist = array();
$not_exist = array();
$attach_dir = get_attachments_dir() . '/';
$attach_dir = get_attachments_dir() .'/';
for ($i = 0; $i < $loops; $i++) {
$start = $i * C_TORRENTS_PER_ONCE;
$offset = C_TORRENTS_PER_ONCE;
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_TORRENTS_PER_ONCE;
$offset = C_TORRENTS_PER_ONCE;
$sql = "SELECT
$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)
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();
$torrents = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($torrents as $torrent)
{
$filename = $attach_dir . $torrent['physical_filename'];
if (!file_exists($filename))
{
$not_exist[] = '<a href="viewtopic.php?t='. $torrent['topic_id'] .'">'. $filename .'</a>';
}
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), ' ');
foreach ($torrents as $torrent) {
$filename = $attach_dir . $torrent['physical_filename'];
if (!file_exists($filename)) {
$not_exist[] = '<a href="viewtopic.php?t=' . $torrent['topic_id'] . '">' . $filename . '</a>';
} 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 ."
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)));
}
}
print_ok ("Completed");
if (!empty($not_exist))
{
print_ok ("These torrents doesn't exist in filesystem: ". implode(', ', array_unique($not_exist)));
}
}

View file

@ -1,8 +1,33 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
if (!defined('EXCLUDED_USERS_CSV')) { define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,))); }
define('TB_USERS_TABLE', 'users');
if (!defined('EXCLUDED_USERS_CSV')) {
define('EXCLUDED_USERS_CSV', join(',', array(GUEST_UID, BOT_UID,)));
}
define('TB_USERS_TABLE', 'users');
define('TB_CATEGORIES_TABLE', 'categories');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
define('MYBB_FORUMS_TABLE', 'mybb_forums');
define('TB_TORRENTS_TABLE', 'torrents');
define('TB_COMMENTS_TABLE', 'comments');
define('MYBB_FORUMS_TABLE', 'mybb_forums');

View file

@ -1,430 +1,432 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
function print_ok ($sql)
function print_ok($sql)
{
global $err;
global $err;
echo ($err) ? "\n<br />" : '';
$err = '';
echo ($err) ? "\n<br />" : '';
$err = '';
echo '<div>';
echo "<font color=darkgreen><b>OK</b> - $sql</font>". str_repeat(' ', 256) ."\n<br />";
echo '</div>';
echo '<div>';
echo "<font color=darkgreen><b>OK</b> - $sql</font>" . str_repeat(' ', 256) . "\n<br />";
echo '</div>';
}
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;
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];
$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];
$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");
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);
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;
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'],
);
$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();
$columns = $values = array();
foreach ($user_data as $column => $value)
{
$columns[] = $column;
$values[] = "'". DB()->escape($value) ."'";
}
$sql_columns = implode(',', $columns);
$sql_values = implode(',', $values);
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);");
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();
$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);
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);");
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);
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;
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();
$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);
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);");
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);
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;
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);
$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;
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);
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;
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);
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;
DB()->query("INSERT IGNORE INTO bb_{$key} ($sql_columns) VALUES ($sql_values);");
}
return;
}
function make_img_path ($name)
function make_img_path($name)
{
global $bb_cfg;
global $bb_cfg;
return make_url("files/images/" . $name);
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);
$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);
$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_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);
$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);
$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']);
}
//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'],
);
$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();
$columns = $values = array();
foreach ($torrent_data as $column => $value)
{
$columns[] = $column;
$values[] = "'". DB()->escape($value) ."'";
}
$sql_columns = implode(', ', $columns);
$sql_values = implode(', ', $values);
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;
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_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;
$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);
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,
);
$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();
$columns = $values = array();
foreach ($forum_data as $column => $value)
{
$columns[] = $column;
$values[] = "'". DB()->escape($value) ."'";
}
$sql_columns = implode(',', $columns);
$sql_values = implode(',', $values);
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;
DB()->query("INSERT IGNORE INTO " . BB_FORUMS . " ($sql_columns) VALUES ($sql_values);");
return;
}

View file

@ -1,3 +1,26 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
$passwords = array();
$passwords = array();

View file

@ -1,18 +1,42 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// Tracker type
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
define('TR_TYPE', 'yse'); // 'sky' (SkyTracker) or 'yse' (TBDev YSE)
// Options
define('CLEAN', true); // Clean TorrentPier's database before converting?
define('CLEAN', true); // Clean TorrentPier's database before converting?
//Users
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
define('CONVERT_USERS', true); // Converting users is enabled?
define('C_USERS_PER_ONCE', 250); // Number of users converting per once
//Torrents and categories
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('CONVERT_TORRENTS', true); // Converting torrents and categories is enabled?
define('C_TORRENTS_PER_ONCE', 400); // Number of torrents converting per once
define('BDECODE', false); // Recalculate info_hash using bdecode?
define('BDECODE', false); // Recalculate info_hash using bdecode?
//Comments
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('CONVERT_COMMENTS', true); // Converting comments is enabled?
define('C_COMMENTS_PER_ONCE', 400); // Number of comments converting per once
//Mybb forums & topics
define('CONVERT_MYBB_FORUMS', false); // Converting forums is enabled?
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once
define('C_FORUMS_PER_ONCE', 100); // Number of forums converting per once

View file

@ -1,97 +1,109 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
require(BB_ROOT .'common.php');
require(INC_DIR .'functions_torrent.php');
require(BB_ROOT . 'common.php');
require(INC_DIR . 'functions_torrent.php');
require(BB_ROOT . 'converter/settings.php');
require(BB_ROOT . 'converter/functions.php');
// Init userdata
$user->session_start();
while (@ob_end_flush());
while (@ob_end_flush()) ;
ob_implicit_flush();
?><!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
</head>
<body style="font: 12px Courier, monospace; white-space: nowrap;">
<?php
if (empty($_POST['confirm']))
{
echo '
if (empty($_POST['confirm'])) {
echo '
<br />
<center>
<form action="'. $_SERVER['PHP_SELF'] .'" method="post">
<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
<input type="submit" name="confirm" value="Recover" />
</form>
</center>
</body>
';
exit;
}
else
{
exit;
} else {
@ini_set('memory_limit', '512M');
@ini_set('max_execution_time', @ini_get('max_execution_time') + 1200);
@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);
$torrents_count = (int) get_count(BB_BT_TORRENTS, 'attach_id');
$loops = (int) ceil($torrents_count / C_TORRENTS_PER_ONCE);
$not_exist = array();
$not_exist = array();
$attach_dir = get_attachments_dir() . '/';
$attach_dir = get_attachments_dir() .'/';
for ($i = 0; $i < $loops; $i++) {
$start = $i * C_TORRENTS_PER_ONCE;
$offset = C_TORRENTS_PER_ONCE;
for ($i = 0; $i < $loops; $i++)
{
$start = $i * C_TORRENTS_PER_ONCE;
$offset = C_TORRENTS_PER_ONCE;
$sql = "SELECT
$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)
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();
$torrents = DB()->fetch_rowset($sql);
DB()->sql_freeresult();
foreach ($torrents as $torrent)
{
$filename = $attach_dir . $torrent['physical_filename'];
if (!file_exists($filename))
{
$not_exist[] = '<a href="viewtopic.php?t='. $torrent['topic_id'] .'">'. $filename .'</a>';
}
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), ' ');
foreach ($torrents as $torrent) {
$filename = $attach_dir . $torrent['physical_filename'];
if (!file_exists($filename)) {
$not_exist[] = '<a href="viewtopic.php?t=' . $torrent['topic_id'] . '">' . $filename . '</a>';
} 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 ."
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)));
}
}
print_ok ("Completed");
if (!empty($not_exist))
{
print_ok ("These torrents doesn't exist in filesystem: ". implode(', ', array_unique($not_exist)));
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,27 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
@ -7,30 +30,31 @@ require(BB_ROOT . 'common.php');
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("ALTER TABLE ". BB_USERS ." CHANGE COLUMN user_birthday user_birthday_old int(11) NOT NULL DEFAULT 0 AFTER user_gender");
DB()->query("ALTER TABLE ". BB_USERS ." ADD user_birthday date NOT NULL DEFAULT '0000-00-00' AFTER user_gender");
DB()->query("ALTER TABLE " . BB_USERS . " CHANGE COLUMN user_birthday user_birthday_old int(11) NOT NULL DEFAULT 0 AFTER user_gender");
DB()->query("ALTER TABLE " . BB_USERS . " ADD user_birthday date NOT NULL DEFAULT '0000-00-00' AFTER user_gender");
$sql = "SELECT user_id, user_birthday_old FROM ". BB_USERS ." WHERE user_birthday_old != 0 AND user_id NOT IN ('". EXCLUDED_USERS_CSV ."')";
$sql = "SELECT user_id, user_birthday_old FROM " . BB_USERS . " WHERE user_birthday_old != 0 AND user_id NOT IN ('" . EXCLUDED_USERS_CSV . "')";
foreach (DB()->fetch_rowset($sql) as $row)
{
$birthday = bb_date($row['user_birthday_old'] * 86400 + 1, 'Y-m-d', 0);
DB()->query("UPDATE ". BB_USERS ." SET user_birthday = '". $birthday ."' WHERE user_id = ". $row['user_id'] ."");
}
foreach (DB()->fetch_rowset($sql) as $row) {
$birthday = bb_date($row['user_birthday_old'] * 86400 + 1, 'Y-m-d', 0);
DB()->query("UPDATE " . BB_USERS . " SET user_birthday = '" . $birthday . "' WHERE user_id = " . $row['user_id'] . "");
}
DB()->query("ALTER TABLE ". BB_USERS ." DROP user_birthday_old");
DB()->query("ALTER TABLE " . BB_USERS . " DROP user_birthday_old");
bb_die('<h1 style="color: green">База данных обновлена</h1>');
bb_die('<h1 style="color: green">База данных обновлена</h1>');
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R496)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R496)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
}
bb_die($msg);
}

View file

@ -1,4 +1,27 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
@ -7,12 +30,14 @@ require(BB_ROOT . 'common.php');
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("
DB()->query("
CREATE TEMPORARY TABLE tmp_buf_dlstatus (
user_id mediumint(9) NOT NULL default '0',
topic_id mediumint(8) unsigned NOT NULL default '0',
@ -21,7 +46,7 @@ if ($confirm) {
) ENGINE = MyISAM
");
DB()->query("
DB()->query("
INSERT INTO tmp_buf_dlstatus
(user_id, topic_id, user_status)
SELECT
@ -29,7 +54,7 @@ if ($confirm) {
FROM bb_bt_dlstatus_new
");
DB()->query("
DB()->query("
REPLACE INTO bb_bt_dlstatus_main
(user_id, topic_id, user_status)
SELECT
@ -37,18 +62,18 @@ if ($confirm) {
FROM tmp_buf_dlstatus
");
DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_buf_dlstatus");
DB()->query("RENAME TABLE bb_bt_dlstatus_main TO bb_bt_dlstatus");
DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_buf_dlstatus");
DB()->query("RENAME TABLE bb_bt_dlstatus_main TO bb_bt_dlstatus");
DB()->query("DROP TABLE IF EXISTS bb_bt_dlstatus_mrg");
DB()->query("DROP TABLE IF EXISTS bb_bt_dlstatus_new");
DB()->query("DROP TABLE IF EXISTS bb_bt_dlstatus_mrg");
DB()->query("DROP TABLE IF EXISTS bb_bt_dlstatus_new");
bb_die('<h1 style="color: green">База данных обновлена</h1>');
bb_die('<h1 style="color: green">База данных обновлена</h1>');
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R571)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R571)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
}
bb_die($msg);
}

View file

@ -1,4 +1,27 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
@ -7,12 +30,14 @@ require(BB_ROOT . 'common.php');
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("
DB()->query("
CREATE TABLE IF NOT EXISTS `bb_poll_users` (
`topic_id` int(10) unsigned NOT NULL,
`user_id` int(11) NOT NULL,
@ -22,7 +47,7 @@ if ($confirm) {
) ENGINE=MyISAM DEFAULT CHARSET=utf8
");
DB()->query("
DB()->query("
CREATE TABLE IF NOT EXISTS `bb_poll_votes` (
`topic_id` int(10) unsigned NOT NULL,
`vote_id` tinyint(4) unsigned NOT NULL,
@ -32,7 +57,7 @@ if ($confirm) {
) ENGINE=MyISAM DEFAULT CHARSET=utf8
");
DB()->query("
DB()->query("
INSERT IGNORE INTO bb_poll_votes
(topic_id, vote_id, vote_text, vote_result)
SELECT
@ -40,7 +65,7 @@ if ($confirm) {
FROM bb_vote_desc;
");
DB()->query("
DB()->query("
INSERT IGNORE INTO bb_poll_votes
(topic_id, vote_id, vote_text, vote_result)
SELECT
@ -50,7 +75,7 @@ if ($confirm) {
d.vote_id = r.vote_id;
");
DB()->query("
DB()->query("
INSERT IGNORE INTO bb_poll_users
(topic_id, user_id, vote_ip)
SELECT
@ -61,16 +86,16 @@ if ($confirm) {
AND v.vote_user_id > 0;
");
DB()->query("DROP TABLE IF EXISTS bb_vote_desc");
DB()->query("DROP TABLE IF EXISTS bb_vote_results");
DB()->query("DROP TABLE IF EXISTS bb_vote_voters");
DB()->query("DROP TABLE IF EXISTS bb_vote_desc");
DB()->query("DROP TABLE IF EXISTS bb_vote_results");
DB()->query("DROP TABLE IF EXISTS bb_vote_voters");
bb_die('<h1 style="color: green">База данных обновлена</h1>');
bb_die('<h1 style="color: green">База данных обновлена</h1>');
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R575)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R575)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
}
bb_die($msg);
}

View file

@ -1,4 +1,27 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
@ -13,26 +36,28 @@ ini_set('display_errors', 1);
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("ALTER TABLE " . BB_USERS . " ADD `avatar_ext_id` TINYINT( 4 ) NOT NULL AFTER `user_rank`");
DB()->query("ALTER TABLE " . BB_USERS . " ADD `avatar_ext_id` TINYINT( 4 ) NOT NULL AFTER `user_rank`");
$rows_per_cycle = 10000;
$rows_per_cycle = 10000;
$row = DB()->fetch_row("SELECT MAX(user_id) AS end_id FROM " . BB_USERS);
$end_id = (int)$row['end_id'];
$start = $avatars_ok = $avatars_err = 0;
$row = DB()->fetch_row("SELECT MAX(user_id) AS end_id FROM " . BB_USERS);
$end_id = (int)$row['end_id'];
$start = $avatars_ok = $avatars_err = 0;
echo "<pre>\n";
echo "<pre>\n";
while (true) {
set_time_limit(600);
echo "$start [ $avatars_ok / $avatars_err ]\n";
$end = $start + $rows_per_cycle - 1;
$sql = "
while (true) {
set_time_limit(600);
echo "$start [ $avatars_ok / $avatars_err ]\n";
$end = $start + $rows_per_cycle - 1;
$sql = "
SELECT user_id, avatar_ext_id, user_avatar
FROM " . BB_USERS . "
WHERE user_avatar != ''
@ -41,44 +66,44 @@ if ($confirm) {
ORDER BY NULL
";
foreach (DB()->fetch_rowset($sql) as $row) {
$FILE = array(
'name' => '',
'type' => '',
'size' => 0,
'tmp_name' => BB_ROOT . $bb_cfg['avatar_path'] . '/' . basename($row['user_avatar']),
'error' => 0,
);
$upload = new upload_common();
foreach (DB()->fetch_rowset($sql) as $row) {
$FILE = array(
'name' => '',
'type' => '',
'size' => 0,
'tmp_name' => BB_ROOT . $bb_cfg['avatar_path'] . '/' . basename($row['user_avatar']),
'error' => 0,
);
$upload = new upload_common();
if ($upload->init($bb_cfg['avatars'], $FILE, false) AND $upload->store('avatar', $row)) {
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = {$upload->file_ext_id} WHERE user_id = {$row['user_id']} LIMIT 1");
$avatars_ok++;
} else {
echo "{$row['user_id']}: ", join("\n{$row['user_id']}: ", $upload->errors), "\n";
$avatars_err++;
}
}
if ($upload->init($bb_cfg['avatars'], $FILE, false) and $upload->store('avatar', $row)) {
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = {$upload->file_ext_id} WHERE user_id = {$row['user_id']} LIMIT 1");
$avatars_ok++;
} else {
echo "{$row['user_id']}: ", join("\n{$row['user_id']}: ", $upload->errors), "\n";
$avatars_err++;
}
}
if ($end > $end_id) {
break;
}
$start += $rows_per_cycle;
sleep(1);
}
if ($end > $end_id) {
break;
}
$start += $rows_per_cycle;
sleep(1);
}
echo "---------- База данных успешно обновлена. Аватары указанных выше пользователей перенесены не были. ----------\n";
echo "---------- База данных успешно обновлена. Аватары указанных выше пользователей перенесены не были. ----------\n";
DB()->query("ALTER TABLE " . BB_USERS . " DROP `user_avatar`");
DB()->query("ALTER TABLE " . BB_USERS . " DROP `user_avatar_type`");
DB()->query("ALTER TABLE " . BB_USERS . " DROP `user_avatar`");
DB()->query("ALTER TABLE " . BB_USERS . " DROP `user_avatar_type`");
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">Перед тем как нажать на кнопку, сделайте бекап базы данных! В ходе обновления базы данных, произойдет автоматическая конвертация имеющихся аватаров пользователей
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">Перед тем как нажать на кнопку, сделайте бекап базы данных! В ходе обновления базы данных, произойдет автоматическая конвертация имеющихся аватаров пользователей
по новому алгоритму. Для конвертации аватарка пользователя должна соответствовать текущим значениям из конфига: ширина не более ' . $bb_cfg['avatars']['max_width'] . ' пикселов, высота не более ' . $bb_cfg['avatars']['max_height'] . ' пикселов
и объем не более ' . $bb_cfg['avatars']['max_size'] . ' байт. Если эти условия не соблюдены - аватарка пользователя не будет конвертирована и пользователю придется залить ее заново! Если вы хотите поправить указанные
значения - ПЕРЕД обновлением базы данных сделайте это в config.php!</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R583)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R583)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
}
bb_die($msg);
}

View file

@ -1,4 +1,27 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
@ -12,41 +35,43 @@ ini_set('display_errors', 1);
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$confirm = request_var('confirm', '');
if ($confirm) {
DB()->query("UPDATE " . BB_CONFIG . " SET `config_value` = 'ru' WHERE `config_name` = 'default_lang'");
DB()->query("ALTER TABLE " . BB_USERS . " ADD `user_twitter` varchar (15) NOT NULL DEFAULT '' AFTER `user_skype`");
DB()->query("UPDATE " . BB_CONFIG . " SET `config_value` = 'ru' WHERE `config_name` = 'default_lang'");
DB()->query("ALTER TABLE " . BB_USERS . " ADD `user_twitter` varchar (15) NOT NULL DEFAULT '' AFTER `user_skype`");
$rows_per_cycle = 10000;
$rows_per_cycle = 10000;
$row = DB()->fetch_row("SELECT MAX(user_id) AS end_id FROM " . BB_USERS);
$end_id = (int)$row['end_id'];
$start = 0;
$row = DB()->fetch_row("SELECT MAX(user_id) AS end_id FROM " . BB_USERS);
$end_id = (int)$row['end_id'];
$start = 0;
while (true) {
set_time_limit(600);
$end = $start + $rows_per_cycle - 1;
while (true) {
set_time_limit(600);
$end = $start + $rows_per_cycle - 1;
DB()->query("UPDATE " . BB_USERS . " SET user_lang = 'ru' WHERE user_lang = 'russian'");
DB()->query("UPDATE " . BB_USERS . " SET user_lang = 'en' WHERE user_lang = 'english'");
DB()->query("UPDATE " . BB_USERS . " SET user_lang = 'ru' WHERE user_lang = 'russian'");
DB()->query("UPDATE " . BB_USERS . " SET user_lang = 'en' WHERE user_lang = 'english'");
if ($end > $end_id) {
break;
}
$start += $rows_per_cycle;
sleep(1);
}
if ($end > $end_id) {
break;
}
$start += $rows_per_cycle;
sleep(1);
}
bb_die("База данных успешно обновлена. Можно приступать к обновлению файлов. Не забудьте удалить этот файл.");
bb_die("База данных успешно обновлена. Можно приступать к обновлению файлов. Не забудьте удалить этот файл.");
} else {
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">Перед тем как нажать на кнопку, сделайте бекап базы данных! В ходе обновления базы данных, произойдет автоматическая конвертация текущих языков интерфейса пользователей
$msg = '<form method="POST">';
$msg .= '<h1 style="color: red">Перед тем как нажать на кнопку, сделайте бекап базы данных! В ходе обновления базы данных, произойдет автоматическая конвертация текущих языков интерфейса пользователей
на новое именование, а также будет добавлено поле в базу данных пользователей, для их Twitter-аккаунтов. После этого, вам можно будет приступать к обновлению файлов.</h1><br />';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R588)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
$msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R588)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
$msg .= '</form>';
bb_die($msg);
}
bb_die($msg);
}

View file

@ -1,4 +1,27 @@
<?php
/**
* MIT License
*
* Copyright (c) 2005-2017 TorrentPier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
define('IN_FORUM', true);
define('BB_ROOT', './');
@ -12,7 +35,9 @@ ini_set('display_errors', 1);
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
if (!IS_SUPER_ADMIN) {
bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
bb_die('
<h1 style="color: red">Для обновления до стабильной ревизии R600, вам необходимо воспользоваться <a
@ -219,4 +244,4 @@ viewonline.php
Все файлы перекодированы для использования окончаний строк LF.
*/
*/