Фикс http://torrentpier.me/threads/23439/ + удаление некоторых неиспользуемых переменных раскиданных по коду. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@557 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08@gmail.com 2014-01-14 21:10:04 +00:00
commit fdf8d769ab
9 changed files with 34 additions and 48 deletions

View file

@ -55,8 +55,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update // Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 (unstable)'; $bb_cfg['tp_version'] = '2.5 (unstable)';
$bb_cfg['tp_release_date'] = '13-01-2014'; $bb_cfg['tp_release_date'] = '15-01-2014';
$bb_cfg['tp_release_state'] = 'R556'; $bb_cfg['tp_release_state'] = 'R557';
// Database // Database
$charset = 'utf8'; $charset = 'utf8';
@ -390,7 +390,7 @@ if (DEBUG)
} }
else else
{ {
error_reporting(E_ALL); # E_ALL & ~E_NOTICE error_reporting(E_ALL); # E_ALL & ~E_NOTICE
ini_set('display_errors', 0); ini_set('display_errors', 0);
ini_set('log_errors', 1); ini_set('log_errors', 1);
} }
@ -408,7 +408,7 @@ define('CRON_ALLOWED', TRIGGERS_DIR .'cron_allowed');
define('CRON_RUNNING', TRIGGERS_DIR .'cron_running'); define('CRON_RUNNING', TRIGGERS_DIR .'cron_running');
// Subforums // Subforums
$bb_cfg['sf_on_first_page_only'] = true; $bb_cfg['sf_on_first_page_only'] = true;
// Forums // Forums
$bb_cfg['allowed_topics_per_page'] = array(50, 100, 150, 200, 250, 300); $bb_cfg['allowed_topics_per_page'] = array(50, 100, 150, 200, 250, 300);
@ -439,19 +439,19 @@ $bb_cfg['max_post_length'] = 120000; // bytes
$bb_cfg['use_ajax_posts'] = true; $bb_cfg['use_ajax_posts'] = true;
// Search // Search
$bb_cfg['search_engine_type'] = 'mysql'; // none, mysql, sphinx $bb_cfg['search_engine_type'] = 'mysql'; // none, mysql, sphinx
$bb_cfg['sphinx_topic_titles_host'] = '127.0.0.1'; $bb_cfg['sphinx_topic_titles_host'] = '127.0.0.1';
$bb_cfg['sphinx_topic_titles_port'] = 3312; $bb_cfg['sphinx_topic_titles_port'] = 3312;
$bb_cfg['sphinx_config_path'] = realpath("../install/sphinx/sphinx.conf"); $bb_cfg['sphinx_config_path'] = realpath("../install/sphinx/sphinx.conf");
$bb_cfg['disable_ft_search_in_posts'] = false; // disable searching in post bodies $bb_cfg['disable_ft_search_in_posts'] = false; // disable searching in post bodies
$bb_cfg['disable_search_for_guest'] = true; $bb_cfg['disable_search_for_guest'] = true;
$bb_cfg['allow_search_in_bool_mode'] = true; $bb_cfg['allow_search_in_bool_mode'] = true;
$bb_cfg['max_search_words_per_post'] = 200; $bb_cfg['max_search_words_per_post'] = 200;
$bb_cfg['search_min_word_len'] = 3; $bb_cfg['search_min_word_len'] = 3;
$bb_cfg['search_max_word_len'] = 35; $bb_cfg['search_max_word_len'] = 35;
$bb_cfg['limit_max_search_results'] = false; $bb_cfg['limit_max_search_results'] = false;
$bb_cfg['tidy_post'] = true; $bb_cfg['tidy_post'] = true;
$bb_cfg['spam_filter_file_path'] = ''; //BB_PATH .'/misc/spam_filter_words.txt'; $bb_cfg['spam_filter_file_path'] = ''; //BB_PATH .'/misc/spam_filter_words.txt';
// Posting // Posting
$bb_cfg['prevent_multiposting'] = true; // replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster $bb_cfg['prevent_multiposting'] = true; // replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster

View file

@ -182,7 +182,7 @@ function sync ($type, $id)
function topic_delete ($mode_or_topic_id, $forum_id = null, $prune_time = 0, $prune_all = false) function topic_delete ($mode_or_topic_id, $forum_id = null, $prune_time = 0, $prune_all = false)
{ {
global $lang, $bb_cfg, $log_action; global $lang, $log_action;
$prune = ($mode_or_topic_id === 'prune'); $prune = ($mode_or_topic_id === 'prune');
@ -519,7 +519,7 @@ function topic_move ($topic_id, $to_forum_id, $from_forum_id = null, $leave_shad
function post_delete ($mode_or_post_id, $user_id = null, $exclude_first = true) function post_delete ($mode_or_post_id, $user_id = null, $exclude_first = true)
{ {
global $bb_cfg, $log_action; global $log_action;
$del_user_posts = ($mode_or_post_id === 'user'); // Delete all user posts $del_user_posts = ($mode_or_post_id === 'user'); // Delete all user posts

View file

@ -1,8 +1,7 @@
<?php <?php
function run_jobs($jobs) { function run_jobs($jobs)
global $bb_cfg, $datastore; {
define('IN_CRON', true); define('IN_CRON', true);
$sql = "SELECT cron_script $sql = "SELECT cron_script

View file

@ -67,7 +67,6 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
$temp_option_text[$option_id] = clean_title($option_text); $temp_option_text[$option_id] = clean_title($option_text);
} }
} }
$option_text = $temp_option_text;
if (count($poll_options) < 2) if (count($poll_options) < 2)
{ {
@ -84,16 +83,16 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
} }
} }
// Check smilies limit // Check smilies limit
if($bb_cfg['max_smilies']) if ($bb_cfg['max_smilies'])
{ {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $bb_cfg['smilies_path']); $count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $bb_cfg['smilies_path']);
if($count_smilies > $bb_cfg['max_smilies']) if ($count_smilies > $bb_cfg['max_smilies'])
{ {
$to_many_smilies = sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']); $to_many_smilies = sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']);
$error_msg .= (!empty($error_msg)) ? '<br />'. $to_many_smilies : $to_many_smilies; $error_msg .= (!empty($error_msg)) ? '<br />'. $to_many_smilies : $to_many_smilies;
} }
} }
if (IS_GUEST && !CAPTCHA()->verify_code()) if (IS_GUEST && !CAPTCHA()->verify_code())
{ {
@ -215,12 +214,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
{ {
$edited_sql .= ", post_time = $current_time "; $edited_sql .= ", post_time = $current_time ";
//lpt //lpt
$result = DB()->sql_query(" DB()->sql_query("UPDATE ". BB_TOPICS ." SET topic_last_post_time = $current_time WHERE topic_id = $topic_id LIMIT 1");
UPDATE ". BB_TOPICS ." SET
topic_last_post_time = $current_time
WHERE topic_id = $topic_id
LIMIT 1
");
} }
$sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '". USER_IP ."')" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . " WHERE post_id = $post_id"; $sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '". USER_IP ."')" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . " WHERE post_id = $post_id";
@ -346,7 +340,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
meta_refresh("viewtopic.php?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id; meta_refresh("viewtopic.php?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id;
$message = $lang['STORED'] . '<br /><br />' . sprintf($lang['CLICK_VIEW_MESSAGE'], '<a href="viewtopic.php?'. POST_POST_URL .'='. $post_id .'#'. $post_id .'">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUM'], '<a href="viewforum.php?'. POST_FORUM_URL .'='. $forum_id . '">', '</a>'); $message = $lang['STORED'] . '<br /><br />' . sprintf($lang['CLICK_VIEW_MESSAGE'], '<a href="viewtopic.php?'. POST_POST_URL .'='. $post_id .'#'. $post_id .'">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUM'], '<a href="viewforum.php?'. POST_FORUM_URL .'='. $forum_id . '">', '</a>');
return $mode; return $mode;
} }
// //

View file

@ -75,7 +75,7 @@ function report_modules_inactive($mode = 'all', $module = null)
$dir = @opendir(INC_DIR .'report_hack'); $dir = @opendir(INC_DIR .'report_hack');
$modules = array(); $modules = array();
$i = 0;
while ($file = @readdir($dir)) while ($file = @readdir($dir))
{ {
if (!preg_match('#(.*)\.' . phpbb_preg_quote('php', '#') . '$#', $file, $matches)) if (!preg_match('#(.*)\.' . phpbb_preg_quote('php', '#') . '$#', $file, $matches))
@ -96,7 +96,7 @@ function report_modules_inactive($mode = 'all', $module = null)
// Include language file // Include language file
$lang = array(); $lang = array();
$lang_file = LANG_ROOT_DIR ."lang_{$bb_cfg['default_lang']}/report_hack/lang_$module_name.php"; $lang_file = LANG_ROOT_DIR ."lang_{$bb_cfg['default_lang']}/report_hack/lang_$module_name.php";
if (file_exists($lang_file)) if (file_exists($lang_file))
{ {
include($lang_file); include($lang_file);

View file

@ -152,7 +152,6 @@ function delete_torrent ($attach_id, $mode = '')
message_die(GENERAL_ERROR, $lang['TOR_NOT_FOUND']); message_die(GENERAL_ERROR, $lang['TOR_NOT_FOUND']);
} }
$post_id = $torrent['post_id'];
$topic_id = $torrent['topic_id']; $topic_id = $torrent['topic_id'];
$forum_id = $torrent['forum_id']; $forum_id = $torrent['forum_id'];
$poster_id = $torrent['poster_id']; $poster_id = $torrent['poster_id'];
@ -162,7 +161,7 @@ function delete_torrent ($attach_id, $mode = '')
message_die(GENERAL_ERROR, $lang['NOT_TORRENT']); message_die(GENERAL_ERROR, $lang['NOT_TORRENT']);
} }
torrent_auth_check($forum_id, $torrent['poster_id']); torrent_auth_check($forum_id, $poster_id);
tracker_unregister($attach_id); tracker_unregister($attach_id);
delete_attachment(0, $attach_id); delete_attachment(0, $attach_id);
@ -198,7 +197,7 @@ function change_tor_status ($attach_id, $new_tor_status)
// Set gold/silver type for torrent // Set gold/silver type for torrent
function change_tor_type ($attach_id, $tor_status_gold) function change_tor_type ($attach_id, $tor_status_gold)
{ {
global $topic_id, $lang, $bb_cfg; global $topic_id, $lang;
if (!$torrent = get_torrent_info($attach_id)) if (!$torrent = get_torrent_info($attach_id))
{ {

View file

@ -585,10 +585,7 @@ class user_common
$this->data['user_lang'] = $bb_cfg['default_lang']; $this->data['user_lang'] = $bb_cfg['default_lang'];
$this->data['user_timezone'] = $bb_cfg['board_timezone']; $this->data['user_timezone'] = $bb_cfg['board_timezone'];
if (!defined('LANG_DIR')) if (!defined('LANG_DIR')) define('LANG_DIR', DEFAULT_LANG_DIR);
{
define('LANG_DIR', DEFAULT_LANG_DIR);
}
require(LANG_DIR .'lang_main.php'); require(LANG_DIR .'lang_main.php');

View file

@ -120,9 +120,6 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
fputs($socket, "MAIL FROM: <" . $bb_cfg['board_email'] . ">\r\n"); fputs($socket, "MAIL FROM: <" . $bb_cfg['board_email'] . ">\r\n");
server_parse($socket, "250", __LINE__); server_parse($socket, "250", __LINE__);
// Specify each user to send to and build to header.
$to_header = '';
// Add an additional bit of error checking to the To field. // Add an additional bit of error checking to the To field.
$mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to); $mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to);
if (preg_match('#[^ ]+\@[^ ]+#', $mail_to)) if (preg_match('#[^ ]+\@[^ ]+#', $mail_to))

View file

@ -838,7 +838,7 @@ if ($submit && !$errors)
if ($bb_cfg['require_activation'] == USER_ACTIVATION_ADMIN) if ($bb_cfg['require_activation'] == USER_ACTIVATION_ADMIN)
{ {
$sql = "SELECT user_email, user_lang, usr_opt FROM ". BB_USERS ." WHERE user_level = " . ADMIN; $sql = "SELECT user_email, user_lang, user_opt FROM ". BB_USERS ." WHERE user_level = " . ADMIN;
if (!($result = DB()->sql_query($sql))) if (!($result = DB()->sql_query($sql)))
{ {