Критический недочет в аяксе, мелочи. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@161 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08 2011-07-26 20:19:44 +00:00
commit d837ce6225
5 changed files with 30 additions and 82 deletions

View file

@ -1,7 +1,7 @@
<?php <?php
define('IN_AJAX', true); define('IN_AJAX', true);
$ajax =& new ajax_common(); $ajax = new ajax_common();
require('./common.php'); require('./common.php');
@ -22,7 +22,7 @@ switch ($ajax->action)
case 'posts': case 'posts':
require(INC_DIR .'bbcode.php'); require(INC_DIR .'bbcode.php');
require(INC_DIR .'functions_post.php'); require(INC_DIR .'functions_post.php');
require(INC_DIR .'functions_admin.php'); require(INC_DIR .'functions_admin.php');
break; break;
@ -30,17 +30,17 @@ switch ($ajax->action)
case 'mod_action': case 'mod_action':
case 'change_tor_status': case 'change_tor_status':
case 'gen_passkey'; case 'gen_passkey';
require(BB_ROOT .'attach_mod/attachment_mod.php'); require(BB_ROOT .'attach_mod/attachment_mod.php');
require(INC_DIR .'functions_torrent.php'); require(INC_DIR .'functions_torrent.php');
break; break;
case 'change_torrent': case 'change_torrent':
require(BB_ROOT .'attach_mod/attachment_mod.php'); require(BB_ROOT .'attach_mod/attachment_mod.php');
require(INC_DIR .'functions_torrent.php'); require(INC_DIR .'functions_torrent.php');
break; break;
case 'user_register': case 'user_register':
require(INC_DIR .'functions_validate.php'); require(INC_DIR .'functions_validate.php');
break; break;
} }
@ -61,19 +61,19 @@ class ajax_common
var $valid_actions = array( var $valid_actions = array(
// ACTION NAME AJAX_AUTH // ACTION NAME AJAX_AUTH
'edit_user_profile' => array('admin'), 'edit_user_profile' => array('admin'),
'change_user_rank' => array('admin'), 'change_user_rank' => array('admin'),
'change_user_opt' => array('admin'), 'change_user_opt' => array('admin'),
'change_tor_status' => array('mod'), 'change_tor_status' => array('mod'),
'mod_action' => array('mod'), 'mod_action' => array('mod'),
'gen_passkey' => array('user'), 'gen_passkey' => array('user'),
'change_torrent' => array('user'), 'change_torrent' => array('user'),
'view_post' => array('guest'), 'view_post' => array('guest'),
'view_torrent' => array('guest'), 'view_torrent' => array('guest'),
'user_register' => array('guest'), 'user_register' => array('guest'),
'posts' => array('guest'), 'posts' => array('guest'),
); );
var $action = null; var $action = null;
@ -206,7 +206,6 @@ class ajax_common
} }
} }
$response_js = bb_json_encode($this->response); $response_js = bb_json_encode($this->response);
if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP'))

View file

@ -1,16 +1,5 @@
<?php <?php
/**
*
* @package attachment_mod
* @version $Id: attachment_mod.php,v 1.6 2005/11/06 18:35:43 acydburn Exp $
* @copyright (c) 2002 Meik Sievertsen
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* Minimum Requirement: PHP 4.2.0
*/
/**
*/
if (!defined('IN_PHPBB')) if (!defined('IN_PHPBB'))
{ {
die('Hacking attempt'); die('Hacking attempt');
@ -55,13 +44,6 @@ function attach_mod_get_lang($language_file)
} }
} }
/**
* Include attachment mod language entries
*/
function include_attach_lang()
{
}
/** /**
* Get attachment mod configuration * Get attachment mod configuration
*/ */
@ -71,8 +53,7 @@ function get_config()
$attach_config = array(); $attach_config = array();
$sql = 'SELECT * $sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
FROM ' . BB_ATTACH_CONFIG;
if ( !($result = DB()->sql_query($sql)) ) if ( !($result = DB()->sql_query($sql)) )
{ {
@ -99,10 +80,7 @@ if (!($attach_config = CACHE('bb_cache')->get('attach_config')))
CACHE('bb_cache')->set('attach_config', $attach_config, 86400); CACHE('bb_cache')->set('attach_config', $attach_config, 86400);
} }
// Please do not change the include-order, it is valuable for proper execution.
// Functions for displaying Attachment Things
include(BB_ROOT .'attach_mod/displaying.php'); include(BB_ROOT .'attach_mod/displaying.php');
// Posting Attachments Class (HAVE TO BE BEFORE PM)
include(BB_ROOT .'attach_mod/posting_attachments.php'); include(BB_ROOT .'attach_mod/posting_attachments.php');
if (!intval($attach_config['allow_ftp_upload'])) if (!intval($attach_config['allow_ftp_upload']))

View file

@ -57,7 +57,7 @@ $bb_cfg['css_ver'] = 1;
// Increase number of revision after update // Increase number of revision after update
$bb_cfg['tp_version'] = '2.0.2'; $bb_cfg['tp_version'] = '2.0.2';
$bb_cfg['tp_release_state'] = 'TP II r158'; $bb_cfg['tp_release_state'] = 'TP II r161';
$bb_cfg['tp_release_date'] = '26-07-2011'; $bb_cfg['tp_release_date'] = '26-07-2011';
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger $bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger

View file

@ -97,8 +97,7 @@ function prepare_message ($message)
// Either in a window or inline // Either in a window or inline
function generate_smilies($mode) function generate_smilies($mode)
{ {
global $bb_cfg, $template, $lang, $images; global $bb_cfg, $template, $lang, $images, $user;
global $user;
$inline_columns = 4; $inline_columns = 4;
$inline_rows = 7; $inline_rows = 7;
@ -109,11 +108,12 @@ function generate_smilies($mode)
$user->session_start(); $user->session_start();
} }
if (!$sql = CACHE('bb_cache')->get('smilies')) if (!$sql = CACHE('bb_cache')->get('smilies'))
{ {
$sql = DB()->fetch_rowset("SELECT emoticon, code, smile_url FROM ". BB_SMILIES ." ORDER BY smilies_id"); $sql = DB()->fetch_rowset("SELECT emoticon, code, smile_url FROM ". BB_SMILIES ." ORDER BY smilies_id");
CACHE('bb_cache')->set('smilies', $sql); CACHE('bb_cache')->set('smilies', $sql);
} }
if ($sql) if ($sql)
{ {
$num_smilies = 0; $num_smilies = 0;
@ -179,7 +179,6 @@ function generate_smilies($mode)
$template->assign_vars(array( $template->assign_vars(array(
'PAGE_TITLE' => $lang['EMOTICONS'], 'PAGE_TITLE' => $lang['EMOTICONS'],
'L_EMOTICONS' => $lang['EMOTICONS'],
'S_SMILIES_COLSPAN' => $s_colspan, 'S_SMILIES_COLSPAN' => $s_colspan,
)); ));
} }
@ -906,9 +905,9 @@ function get_parsed_post ($postrow, $mode = 'full', $return_chars = 600)
return $postrow['post_html']; return $postrow['post_html'];
} }
$message = bbcode2html($postrow['post_text']); $message = bbcode2html($postrow['post_text']);
// Posts cache // Posts cache
if ($bb_cfg['use_posts_cache']) if ($bb_cfg['use_posts_cache'])
{ {
DB()->shutdown['post_html'][] = array( DB()->shutdown['post_html'][] = array(

View file

@ -79,12 +79,9 @@ function set_tracks ($cookie_name, &$tracking_ary, $tracks = null, $val = TIMENO
{ {
$tracking_ary[$key] = $val; $tracking_ary[$key] = $val;
} }
else elseif ($curr_track_val < $user->data['user_lastvisit'])
{ {
if ($curr_track_val < $user->data['user_lastvisit']) unset($tracking_ary[$key]);
{
unset($tracking_ary[$key]);
}
} }
} }
} }
@ -1808,17 +1805,19 @@ function obtain_word_list(&$orig_word, &$replacement_word)
if (!$bb_cfg['use_word_censor']) return; if (!$bb_cfg['use_word_censor']) return;
if (!$sql = CACHE('bb_cache')->get('censored')) if (!$sql = CACHE('bb_cache')->get('censored'))
{ {
$sql = DB()->fetch_rowset("SELECT word, replacement FROM ". BB_WORDS); $sql = DB()->fetch_rowset("SELECT word, replacement FROM ". BB_WORDS);
CACHE('bb_cache')->set('censored', $sql, 7200); CACHE('bb_cache')->set('censored', $sql, 7200);
} }
foreach($sql as $row)
{ foreach($sql as $row)
//$orig_word[] = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($row['word'], '#')) . ')(?!\S)#iu'; {
//$orig_word[] = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($row['word'], '#')) . ')(?!\S)#iu';
$orig_word[] = '#(?<![\p{Nd}\p{L}_])(' . str_replace('\*', '[\p{Nd}\p{L}_]*?', preg_quote($row['word'], '#')) . ')(?![\p{Nd}\p{L}_])#iu'; $orig_word[] = '#(?<![\p{Nd}\p{L}_])(' . str_replace('\*', '[\p{Nd}\p{L}_]*?', preg_quote($row['word'], '#')) . ')(?![\p{Nd}\p{L}_])#iu';
$replacement_word[] = $row['replacement']; $replacement_word[] = $row['replacement'];
} }
return true; return true;
} }
@ -1832,25 +1831,6 @@ function smiley_sort ($a, $b)
return (strlen($a['code']) > strlen($b['code'])) ? -1 : 1; return (strlen($a['code']) > strlen($b['code'])) ? -1 : 1;
} }
//
// This is general replacement for die(), allows templated
// output in users (or default) language, etc.
//
// $msg_code can be one of these constants:
//
// GENERAL_MESSAGE : Use for any simple text message, eg. results
// of an operation, authorisation failures, etc.
//
// GENERAL ERROR : Use for any error which occurs _AFTER_ the
// common.php include and session code, ie. most errors in
// pages/functions
//
// CRITICAL_MESSAGE : Used when basic config data is available but
// a session may not exist, eg. banned users
//
// CRITICAL_ERROR : Used when config data cannot be obtained, eg
// no database connection. Should _not_ be used in 99.5% of cases
//
function bb_die ($msg_text) function bb_die ($msg_text)
{ {
if (defined('IN_AJAX')) if (defined('IN_AJAX'))
@ -1862,8 +1842,7 @@ function bb_die ($msg_text)
function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{ {
global $DBS, $template, $bb_cfg, $theme, $lang, $nav_links, $gen_simple_header, $images; global $DBS, $template, $bb_cfg, $theme, $lang, $nav_links, $gen_simple_header, $images, $userdata;
global $userdata;
if (defined('HAS_DIED')) if (defined('HAS_DIED'))
{ {
@ -1969,18 +1948,11 @@ function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = ''
} }
else else
{ {
# while (@ob_end_clean());
echo "<html>\n<body>\n". $msg_title ."\n<br /><br />\n". $msg_text ."</body>\n</html>"; echo "<html>\n<body>\n". $msg_title ."\n<br /><br />\n". $msg_text ."</body>\n</html>";
} }
exit; exit;
} }
//
// This function is for compatibility with PHP 4.x's realpath()
// function. In later versions of PHP, it needs to be called
// to do checks with some functions. Older versions of PHP don't
// seem to need this, so we'll just return the original value.
// dougk_ff7 <October 5, 2002>
function phpbb_realpath($path) function phpbb_realpath($path)
{ {
return (!@function_exists('realpath') || !@realpath(INC_DIR . 'functions.php')) ? $path : @realpath($path); return (!@function_exists('realpath') || !@realpath(INC_DIR . 'functions.php')) ? $path : @realpath($path);