From d837ce6225ba6effa41154ee40744e62999d2548 Mon Sep 17 00:00:00 2001 From: glix08 Date: Tue, 26 Jul 2011 20:19:44 +0000 Subject: [PATCH] r161 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Критический недочет в аяксе, мелочи. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@161 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/ajax.php | 27 ++++++++-------- upload/attach_mod/attachment_mod.php | 24 +------------- upload/config.php | 2 +- upload/includes/bbcode.php | 11 +++---- upload/includes/functions.php | 48 ++++++---------------------- 5 files changed, 30 insertions(+), 82 deletions(-) diff --git a/upload/ajax.php b/upload/ajax.php index d077d7d1f..241ca9a72 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -1,7 +1,7 @@ action) case 'posts': require(INC_DIR .'bbcode.php'); - require(INC_DIR .'functions_post.php'); + require(INC_DIR .'functions_post.php'); require(INC_DIR .'functions_admin.php'); break; @@ -30,17 +30,17 @@ switch ($ajax->action) case 'mod_action': case 'change_tor_status': 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'); break; - case 'change_torrent': - require(BB_ROOT .'attach_mod/attachment_mod.php'); + case 'change_torrent': + require(BB_ROOT .'attach_mod/attachment_mod.php'); require(INC_DIR .'functions_torrent.php'); break; case 'user_register': - require(INC_DIR .'functions_validate.php'); + require(INC_DIR .'functions_validate.php'); break; } @@ -61,19 +61,19 @@ class ajax_common var $valid_actions = array( // ACTION NAME AJAX_AUTH 'edit_user_profile' => array('admin'), - 'change_user_rank' => array('admin'), - 'change_user_opt' => array('admin'), + 'change_user_rank' => array('admin'), + 'change_user_opt' => array('admin'), 'change_tor_status' => array('mod'), 'mod_action' => array('mod'), - 'gen_passkey' => array('user'), - 'change_torrent' => array('user'), + 'gen_passkey' => array('user'), + 'change_torrent' => array('user'), 'view_post' => array('guest'), - 'view_torrent' => array('guest'), - 'user_register' => array('guest'), - 'posts' => array('guest'), + 'view_torrent' => array('guest'), + 'user_register' => array('guest'), + 'posts' => array('guest'), ); var $action = null; @@ -206,7 +206,6 @@ class ajax_common } } - $response_js = bb_json_encode($this->response); if (GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) diff --git a/upload/attach_mod/attachment_mod.php b/upload/attach_mod/attachment_mod.php index d68b19806..76497f0e5 100644 --- a/upload/attach_mod/attachment_mod.php +++ b/upload/attach_mod/attachment_mod.php @@ -1,16 +1,5 @@ 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); } -// 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'); -// Posting Attachments Class (HAVE TO BE BEFORE PM) include(BB_ROOT .'attach_mod/posting_attachments.php'); if (!intval($attach_config['allow_ftp_upload'])) diff --git a/upload/config.php b/upload/config.php index cae2809ce..2947f9deb 100644 --- a/upload/config.php +++ b/upload/config.php @@ -57,7 +57,7 @@ $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 r158'; +$bb_cfg['tp_release_state'] = 'TP II r161'; $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 diff --git a/upload/includes/bbcode.php b/upload/includes/bbcode.php index 088f759cf..22bca8df5 100644 --- a/upload/includes/bbcode.php +++ b/upload/includes/bbcode.php @@ -97,8 +97,7 @@ function prepare_message ($message) // Either in a window or inline function generate_smilies($mode) { - global $bb_cfg, $template, $lang, $images; - global $user; + global $bb_cfg, $template, $lang, $images, $user; $inline_columns = 4; $inline_rows = 7; @@ -109,11 +108,12 @@ function generate_smilies($mode) $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"); CACHE('bb_cache')->set('smilies', $sql); } + if ($sql) { $num_smilies = 0; @@ -179,7 +179,6 @@ function generate_smilies($mode) $template->assign_vars(array( 'PAGE_TITLE' => $lang['EMOTICONS'], - 'L_EMOTICONS' => $lang['EMOTICONS'], 'S_SMILIES_COLSPAN' => $s_colspan, )); } @@ -906,9 +905,9 @@ function get_parsed_post ($postrow, $mode = 'full', $return_chars = 600) return $postrow['post_html']; } - $message = bbcode2html($postrow['post_text']); + $message = bbcode2html($postrow['post_text']); - // Posts cache + // Posts cache if ($bb_cfg['use_posts_cache']) { DB()->shutdown['post_html'][] = array( diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 767152aee..a014e0088 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -79,12 +79,9 @@ function set_tracks ($cookie_name, &$tracking_ary, $tracks = null, $val = TIMENO { $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 (!$sql = CACHE('bb_cache')->get('censored')) + if (!$sql = CACHE('bb_cache')->get('censored')) { $sql = DB()->fetch_rowset("SELECT word, replacement FROM ". BB_WORDS); CACHE('bb_cache')->set('censored', $sql, 7200); } - foreach($sql as $row) - { - //$orig_word[] = '#(? 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) { 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 = '') { - global $DBS, $template, $bb_cfg, $theme, $lang, $nav_links, $gen_simple_header, $images; - global $userdata; + global $DBS, $template, $bb_cfg, $theme, $lang, $nav_links, $gen_simple_header, $images, $userdata; if (defined('HAS_DIED')) { @@ -1969,18 +1948,11 @@ function message_die ($msg_code, $msg_text = '', $msg_title = '', $err_line = '' } else { -# while (@ob_end_clean()); echo "\n\n". $msg_title ."\n

\n". $msg_text ."\n"; } 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 function phpbb_realpath($path) { return (!@function_exists('realpath') || !@realpath(INC_DIR . 'functions.php')) ? $path : @realpath($path);