From 2935e685d806c133176c039bf0e736d41d049fe3 Mon Sep 17 00:00:00 2001 From: nanosimbiot Date: Tue, 12 Jul 2011 20:59:50 +0000 Subject: [PATCH] r100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit авторегистрация торрента git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@100 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/ajax.php | 4 ++-- upload/ajax/change_tor_status.php | 4 ++-- upload/ajax/change_torrent.php | 12 +++++++++-- upload/ajax/view_torrent.php | 5 ++--- upload/attach_mod/posting_attachments.php | 9 +++++++- upload/config.php | 22 ++++++-------------- upload/includes/init_bb.php | 2 +- upload/includes/page_footer.php | 5 ++++- upload/includes/page_header.php | 5 ++++- upload/includes/ucp/usercp_register.php | 4 ++-- upload/language/lang_english/lang_main.php | 2 +- upload/language/lang_russian/lang_main.php | 2 +- upload/posting.php | 5 +---- upload/templates/default/usercp_register.tpl | 2 +- 14 files changed, 45 insertions(+), 38 deletions(-) diff --git a/upload/ajax.php b/upload/ajax.php index 6e4477481..d677ae02d 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -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']); } diff --git a/upload/ajax/change_tor_status.php b/upload/ajax/change_tor_status.php index 7940c71c5..38f520802 100644 --- a/upload/ajax/change_tor_status.php +++ b/upload/ajax/change_tor_status.php @@ -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']); } diff --git a/upload/ajax/change_torrent.php b/upload/ajax/change_torrent.php index 1dc9623b9..de5de12ed 100644 --- a/upload/ajax/change_torrent.php +++ b/upload/ajax/change_torrent.php @@ -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'; diff --git a/upload/ajax/view_torrent.php b/upload/ajax/view_torrent.php index 60a68317c..e00d9712b 100644 --- a/upload/ajax/view_torrent.php +++ b/upload/ajax/view_torrent.php @@ -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); } diff --git a/upload/attach_mod/posting_attachments.php b/upload/attach_mod/posting_attachments.php index 2320db08b..88f6b71c1 100644 --- a/upload/attach_mod/posting_attachments.php +++ b/upload/attach_mod/posting_attachments.php @@ -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 .= '
'; } - $error_msg .= $lang['ALLOWED_ONLY_1ST_POST_ATTACH']; + $error_msg .= $lang['Allowed_only_1st_post_attach']; } //bt end diff --git a/upload/config.php b/upload/config.php index f1f640f37..6fe58402a 100644 --- a/upload/config.php +++ b/upload/config.php @@ -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']; @@ -301,9 +293,9 @@ define('AJAX_HTML_DIR', BB_ROOT .'ajax/html/'); define('AJAX_DIR', BB_ROOT .'ajax/'); // Debug -define('DEBUG', false); // !!! "DEBUG" should be ALWAYS DISABLED on production environment !!! +define('DEBUG', false); // !!! "DEBUG" should be ALWAYS DISABLED on production environment !!! define('DBG_LOG', false); -define('DBG_TIME', true); // false, true или рабочая секудна (при 3 - запись в лог будет только если текущее время кратно 3) +define('DBG_TIME', true); // false, true или рабочая секудна (при 3 - запись в лог будет только если текущее время кратно 3) define('DBG_LOG_GENTIME', true); define('DBG_LOG_ERRORS', true); define('PROFILER', false); // Profiler extension name, or FALSE to disable (supported: 'dbg') @@ -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'; diff --git a/upload/includes/init_bb.php b/upload/includes/init_bb.php index c1429333f..3557b3985 100644 --- a/upload/includes/init_bb.php +++ b/upload/includes/init_bb.php @@ -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); diff --git a/upload/includes/page_footer.php b/upload/includes/page_footer.php index 99b4fe5de..bff04a8e4 100644 --- a/upload/includes/page_footer.php +++ b/upload/includes/page_footer.php @@ -22,7 +22,10 @@ if (!empty($template)) $show_dbg_info = (DBG_USER && IS_ADMIN && !defined('IN_ADMIN')); -flush(); +if(!$bb_cfg['gzip_compress']) +{ + flush(); +} if ($show_dbg_info) { diff --git a/upload/includes/page_header.php b/upload/includes/page_header.php index e8e312366..d66068ba8 100644 --- a/upload/includes/page_header.php +++ b/upload/includes/page_header.php @@ -354,4 +354,7 @@ $template->pparse('page_header'); define('PAGE_HEADER_SENT', true); -flush(); +if(!$bb_cfg['gzip_compress']) +{ + flush(); +} \ No newline at end of file diff --git a/upload/includes/ucp/usercp_register.php b/upload/includes/ucp/usercp_register.php index a3d758e6e..bfa2acf72 100644 --- a/upload/includes/ucp/usercp_register.php +++ b/upload/includes/ucp/usercp_register.php @@ -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'], ''. $users['username'] .'', $bb_cfg['tech_admin_email'])); + bb_die(sprintf($lang['ALREADY_REG_IP'], ''. $users['username'] .'', $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; } diff --git a/upload/language/lang_english/lang_main.php b/upload/language/lang_english/lang_main.php index df0b8f1db..ab6d3232a 100644 --- a/upload/language/lang_english/lang_main.php +++ b/upload/language/lang_english/lang_main.php @@ -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 Administrator'; +$lang['ALREADY_REG_IP'] = 'With your IP-address is already registered user %s. If you have not previously registered on our tracker, mail to Administrator'; // // That's all, Folks! diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php index 4c5b42d10..2da54f5a1 100644 --- a/upload/language/lang_russian/lang_main.php +++ b/upload/language/lang_russian/lang_main.php @@ -1348,7 +1348,7 @@ $lang['LOGS'] = 'История темы'; $lang['LAST_IP'] = 'Последний IP:'; $lang['REG_IP'] = 'IP регистрации:'; -$lang['ALREADY_REG'] = 'С вашего IP-адреса уже зарегистрирован пользователь %s. Если Вы ранее не регистрировались на нашем трекере, обратитесь к Администрации'; +$lang['ALREADY_REG_IP'] = 'С вашего IP-адреса уже зарегистрирован пользователь %s. Если Вы ранее не регистрировались на нашем трекере, обратитесь к Администрации'; // // That's all, Folks! diff --git a/upload/posting.php b/upload/posting.php index f819356b8..91446f75f 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -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'); diff --git a/upload/templates/default/usercp_register.tpl b/upload/templates/default/usercp_register.tpl index e1ad13319..b50a9884e 100644 --- a/upload/templates/default/usercp_register.tpl +++ b/upload/templates/default/usercp_register.tpl @@ -33,7 +33,7 @@ ajax.callback.user_register = function(data){ {L_EMAIL}: *
{L_EMAIL_EXPLAIN}
- readonly="readonly" style="color: gray;" /> + readonly="readonly" style="color: gray;" />