авторегистрация торрента git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@100 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
nanosimbiot 2011-07-12 20:59:50 +00:00
commit 2935e685d8
14 changed files with 45 additions and 38 deletions

View file

@ -59,11 +59,11 @@ class ajax_common
'change_user_rank' => array('admin'),
'change_user_opt' => array('admin'),
'change_torrent' => array('mod'),
'change_tor_status' => array('mod'),
'mod_action' => array('mod'),
'gen_passkey' => array('user'),
'change_torrent' => array('user'),
'view_post' => array('guest'),
'view_message' => array('guest'),
@ -124,7 +124,7 @@ class ajax_common
// MOD
case 'mod':
if (!(IS_MOD || IS_ADMIN))
if (!IS_AM)
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
}

View file

@ -39,7 +39,7 @@ if ($tor['tor_status'] == $new_status)
$this->ajax_die('Раздача имеет тот же статус');
}
// Запрет на изменение/присвоение CH-статуса модератором
if ($new_status == TOR_CLOSED_CPHOLD && !(IS_ADMIN || IS_CP_HOLDER))
if ($new_status == TOR_CLOSED_CPHOLD && !IS_ADMIN)
{
$this->ajax_die('Изменение статуса невозможно');
}
@ -47,7 +47,7 @@ if ($new_status == TOR_CLOSED_CPHOLD && !(IS_ADMIN || IS_CP_HOLDER))
// Права на изменение статуса
if ($tor['tor_status'] == TOR_CLOSED_CPHOLD)
{
if (!(IS_ADMIN || IS_CP_HOLDER))
if (!IS_ADMIN)
{
$this->verify_mod_rights($tor['forum_id']);
}

View file

@ -2,8 +2,6 @@
if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg;
global $userdata, $bb_cfg, $lang;
if (!isset($this->request['attach_id']))
@ -39,6 +37,16 @@ $torrent = DB()->fetch_row("
");
if (!$torrent) $this->ajax_die('Invalid attach_id');
if($torrent['poster_id'] == $userdata['user_id'] && !IS_AM)
{
if($type == 'del_torrent' || $type == 'reg' || $type == 'unreg')
{ true; }
else
{ $this->ajax_die($lang['ONLY_FOR_MOD']); } }
elseif(!IS_AM)
{ $this->ajax_die($lang['ONLY_FOR_MOD']); }
$title = $url = '';
switch($type)
{ case 'set_gold';

View file

@ -27,7 +27,6 @@ if (($file_contents = @file_get_contents($filename)) === false)
{
$this->ajax_die('файл временно не доступен');
}
}
// Построение списка
@ -104,7 +103,7 @@ class torrent
}
array_deep($f['path'], 'clean_tor_dirname');
$length = isset($f['length']) ? (int) $f['length'] : 0;
$length = isset($f['length']) ? $f['length'] : 0;
$subdir_count = count($f['path']) - 1;
if ($subdir_count > 0)
@ -143,7 +142,7 @@ class torrent
{
$this->multiple = false;
$name = isset($info['name']) ? clean_tor_dirname($info['name']) : '';
$length = isset($info['length']) ? (int) $info['length'] : 0;
$length = isset($info['length']) ? $info['length'] : 0;
$this->files_ary['/'][] = $this->build_file_item($name, $length);
}

View file

@ -661,6 +661,13 @@ class attach_parent
{
if ($this->attachment_id_list[$i])
{
//bt
if ($this->attachment_extension_list[$i] === TORRENT_EXT && !defined('TORRENT_ATTACH_ID'))
{
define('TORRENT_ATTACH_ID', $this->attachment_id_list[$i]);
}
//bt end
// update entry in db if attachment already stored in db and filespace
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . "
SET comment = '" . @attach_mod_sql_escape($this->attachment_comment_list[$i]) . "'
@ -995,7 +1002,7 @@ class attach_parent
{
$error_msg .= '<br />';
}
$error_msg .= $lang['ALLOWED_ONLY_1ST_POST_ATTACH'];
$error_msg .= $lang['Allowed_only_1st_post_attach'];
}
//bt end

View file

@ -57,8 +57,8 @@ $bb_cfg['css_ver'] = 1;
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.0.2';
$bb_cfg['tp_release_state'] = 'TP II r99';
$bb_cfg['tp_release_date'] = '12-07-2011';
$bb_cfg['tp_release_state'] = 'TP II r100';
$bb_cfg['tp_release_date'] = '13-07-2011';
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
$bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут";
@ -72,15 +72,10 @@ $dbcharset = 'utf8';
$pconnect = false;
$bb_cfg['db']['db1'] = array($dbhost, $dbname, $dbuser, $dbpasswd, $dbcharset, $pconnect);
$bb_cfg['db_alias'] = array(
// 'alias' => 'srv_name'
);
// http://www.php.net/manual/en/mysql.constants.php#mysql.client-flags
define('DBFLAGS', NULL); // Flags: MYSQL_CLIENT_COMPRESS - Compress MySQL
define('DBMS', 'mysql');
// Cache
$bb_cfg['cache']['pconnect'] = false;
$bb_cfg['cache']['db_dir'] = realpath(BB_ROOT) .'/cache/filecache/';
@ -267,8 +262,7 @@ $bb_cfg['db_backup_shell_cmd'] = ''; // '/path/to/db_backup.sh 2>&
$bb_cfg['site_backup_shell_cmd'] = '';
// GZip
$bb_cfg['gzip_compress'] = false; // compress output
$bb_cfg['gzip_force'] = false; // always compress (don't check client compatibility)
$bb_cfg['gzip_compress'] = true; // compress output
// Sessions
$bb_cfg['session_update_intrv'] = 180; // sec
@ -287,11 +281,9 @@ $bb_cfg['new_user_reg_restricted'] = false;
// Email
$bb_cfg['emailer_disabled'] = false;
$bb_cfg['topic_notify_enabled'] = true;
$bb_cfg['pm_notify_enabled'] = true;
$bb_cfg['groupcp_send_email'] = true;
$bb_cfg['email_change_disabled'] = false; // disable changing email by user
$bb_cfg['tech_admin_email'] = 'admin@' . $bb_cfg['server_name']; // email for sending error reports
$bb_cfg['abuse_email'] = 'abuse@' . $bb_cfg['server_name'];
@ -315,7 +307,6 @@ define('SQL_LOG_SLOW_QUERIES', true);
define('SQL_SLOW_QUERY_TIME', 10); // sec
define('SQL_PREPEND_SRC_COMM', false); // prepend source file(line) comment to sql query
// Special users
$bb_cfg['dbg_users'] = array(
# user_id => 'name',
@ -379,7 +370,7 @@ define('CRON_ALLOWED', TRIGGERS_DIR .'cron_allowed');
define('CRON_RUNNING', TRIGGERS_DIR .'cron_running');
// Cron
$bb_cfg['cron_enabled'] = false; // При отвязки крона старт производить из cron.php
$bb_cfg['cron_enabled'] = true; // При отвязки крона старт производить из cron.php
$bb_cfg['cron_check_interval'] = 300; // sec
// News
@ -514,7 +505,6 @@ $bb_cfg['user_agreement_html_path'] = $bb_cfg['html_path'] .'user_agreement.h
$bb_cfg['copyright_holders_html_path'] = $bb_cfg['html_path'] .'copyright_holders.html'; #
$bb_cfg['advert_html_path'] = $bb_cfg['html_path'] .'advert.html'; #
// Captcha
$bb_cfg['captcha']['disabled'] = false;
$bb_cfg['captcha']['secret_key'] = 'secret_key';

View file

@ -82,7 +82,7 @@ function compress_output ($contents)
if ($bb_cfg['gzip_compress'] && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))
{
if ((UA_GZIP_SUPPORTED || $bb_cfg['gzip_force']) && strlen($contents) > 2000)
if (UA_GZIP_SUPPORTED && strlen($contents) > 2000)
{
header('Content-Encoding: gzip');
$contents = gzencode($contents, 1);

View file

@ -22,7 +22,10 @@ if (!empty($template))
$show_dbg_info = (DBG_USER && IS_ADMIN && !defined('IN_ADMIN'));
if(!$bb_cfg['gzip_compress'])
{
flush();
}
if ($show_dbg_info)
{

View file

@ -354,4 +354,7 @@ $template->pparse('page_header');
define('PAGE_HEADER_SENT', true);
if(!$bb_cfg['gzip_compress'])
{
flush();
}

View file

@ -46,7 +46,7 @@ switch ($mode)
{
if($users = DB()->fetch_row("SELECT user_id, username FROM ". BB_USERS ." WHERE user_reg_ip = '". USER_IP ."' LIMIT 1"))
{
bb_die(sprintf($lang['ALREADY_REG'], '<a href="'. PROFILE_URL . $users['user_id'] .'"><b>'. $users['username'] .'</b></a>', $bb_cfg['tech_admin_email']));
bb_die(sprintf($lang['ALREADY_REG_IP'], '<a href="'. PROFILE_URL . $users['user_id'] .'"><b>'. $users['username'] .'</b></a>', $bb_cfg['tech_admin_email']));
}
}
@ -202,7 +202,7 @@ foreach ($profile_fields as $field => $can_edit)
if ($submit)
{
if (!$errors AND $err = validate_username($username))
if (!$errors AND $err = validate_username($username) && $mode == 'register')
{
$errors[] = $err;
}

View file

@ -1342,7 +1342,7 @@ $lang['LOGS'] = 'Topic history';
$lang['LAST_IP'] = 'Last IP:';
$lang['REG_IP'] = 'Registration IP:';
$lang['ALREADY_REG'] = 'With your IP-address is already registered user %s. If you have not previously registered on our tracker, mail to <a href="mailto:%s">Administrator</ a>';
$lang['ALREADY_REG_IP'] = 'With your IP-address is already registered user %s. If you have not previously registered on our tracker, mail to <a href="mailto:%s">Administrator</ a>';
//
// That's all, Folks!

View file

@ -1348,7 +1348,7 @@ $lang['LOGS'] = 'История темы';
$lang['LAST_IP'] = 'Последний IP:';
$lang['REG_IP'] = 'IP регистрации:';
$lang['ALREADY_REG'] = 'С вашего IP-адреса уже зарегистрирован пользователь %s. Если Вы ранее не регистрировались на нашем трекере, обратитесь к <a href="mailto:%s">Администрации</a>';
$lang['ALREADY_REG_IP'] = 'С вашего IP-адреса уже зарегистрирован пользователь %s. Если Вы ранее не регистрировались на нашем трекере, обратитесь к <a href="mailto:%s">Администрации</a>';
//
// That's all, Folks!

View file

@ -532,10 +532,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
$torrent_ext = (@$attachment_mod['posting']->extension === TORRENT_EXT || @$attachment_mod['posting']->attachment_extension_list[0] === TORRENT_EXT);
$torrent_attach = ($torrent_ext && defined('TORRENT_ATTACH_ID') && 1 == count($attachment_mod['posting']->attachment_list));
if ($torrent_attach && $bb_cfg['bt_newtopic_auto_reg'] && $mode == 'newtopic' && !$error_msg)
if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
{
include(INC_DIR .'functions_torrent.php');
tracker_register(TORRENT_ATTACH_ID, 'newtopic');

View file

@ -33,7 +33,7 @@ ajax.callback.user_register = function(data){
</tr>
<tr>
<td>{L_EMAIL}: * <!-- IF EDIT_PROFILE --><!-- ELSE IF $bb_cfg['reg_email_activation'] --><h6>{L_EMAIL_EXPLAIN}</h6><!-- ENDIF --></td>
<td><input id="email" onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;" type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}" <!-- IF EDIT_PROFILE --><!-- IF $bb_cfg['email_change_disabled'] -->readonly="readonly" style="color: gray;"<!-- ENDIF --><!-- ENDIF --> />
<td><input id="email" onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;" type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}" <!-- IF EDIT_PROFILE --><!-- IF $bb_cfg['emailer_disabled'] -->readonly="readonly" style="color: gray;"<!-- ENDIF --><!-- ENDIF --> />
<span id="check_email"></span></td>
</tr>
<!-- IF EDIT_PROFILE and not ADM_EDIT -->