From 264355d79b5f74f82f3b34b3b9247712abbc7f4d Mon Sep 17 00:00:00 2001
From: Exile
Date: Sat, 24 Jan 2015 15:19:24 +0300
Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B4=D0=BE=D0=BB=D0=B6?=
=?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?=
=?UTF-8?q?=D0=B8=D1=8F=20=D0=B0=D1=82=D1=82=D0=B0=D1=87-=D0=BC=D0=BE?=
=?UTF-8?q?=D0=B4=D0=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Промежуточная ревизия - большое число правок в постинге, переименование проблемного (ad) смайлика, удаление устаревших неиспользуемых функций.
---
admin/admin_smilies.php | 14 +--
install/sql/mysql.sql | 2 +-
library/includes/functions_post.php | 35 ------
library/language/en/main.php | 2 -
library/language/ru/main.php | 2 -
library/language/uk/main.php | 2 -
posting.php | 133 ++++++++-------------
styles/images/smiles/{ad.gif => cd.gif} | Bin
styles/templates/default/posting.tpl | 151 +++++++++++++++---------
9 files changed, 152 insertions(+), 189 deletions(-)
rename styles/images/smiles/{ad.gif => cd.gif} (100%)
diff --git a/admin/admin_smilies.php b/admin/admin_smilies.php
index 4d60e7090..0b99fbf79 100644
--- a/admin/admin_smilies.php
+++ b/admin/admin_smilies.php
@@ -253,14 +253,14 @@ else if ( $mode != '' )
$s_hidden_fields = '';
$template->assign_vars(array(
- 'TPL_SMILE_EDIT' => true,
- 'SMILEY_CODE' => $smile_data['code'],
- 'SMILEY_EMOTICON' => $smile_data['emoticon'],
- 'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_edit_img,
- 'S_SMILEY_ACTION' => "admin_smilies.php",
- 'S_HIDDEN_FIELDS' => $s_hidden_fields,
+ 'TPL_SMILE_EDIT' => true,
+ 'SMILEY_CODE' => $smile_data['code'],
+ 'SMILEY_EMOTICON' => $smile_data['emoticon'],
+ 'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_edit_img, // TODO
+ 'S_SMILEY_ACTION' => "admin_smilies.php",
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
- 'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path'],
+ 'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path'],
));
break;
diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql
index 8fa8895f5..327fe14e3 100644
--- a/install/sql/mysql.sql
+++ b/install/sql/mysql.sql
@@ -881,7 +881,6 @@ CREATE TABLE IF NOT EXISTS `bb_smilies` (
INSERT INTO `bb_smilies` VALUES ('', ':aa:', 'aa.gif', 'aa');
INSERT INTO `bb_smilies` VALUES ('', ':ab:', 'ab.gif', 'ab');
INSERT INTO `bb_smilies` VALUES ('', ':ac:', 'ac.gif', 'ac');
-INSERT INTO `bb_smilies` VALUES ('', ':ad:', 'ad.gif', 'ad');
INSERT INTO `bb_smilies` VALUES ('', ':ae:', 'ae.gif', 'ae');
INSERT INTO `bb_smilies` VALUES ('', ':af:', 'af.gif', 'af');
INSERT INTO `bb_smilies` VALUES ('', ':ag:', 'ag.gif', 'ag');
@@ -933,6 +932,7 @@ INSERT INTO `bb_smilies` VALUES ('', ':bz:', 'bz.gif', 'bz');
INSERT INTO `bb_smilies` VALUES ('', ':ca:', 'ca.gif', 'ca');
INSERT INTO `bb_smilies` VALUES ('', ':cb:', 'cb.gif', 'cb');
INSERT INTO `bb_smilies` VALUES ('', ':cc:', 'cc.gif', 'cc');
+INSERT INTO `bb_smilies` VALUES ('', ':сd:', 'сd.gif', 'сd');
-- ----------------------------
-- Table structure for `bb_topics`
diff --git a/library/includes/functions_post.php b/library/includes/functions_post.php
index 07e3a40b7..7923a53be 100644
--- a/library/includes/functions_post.php
+++ b/library/includes/functions_post.php
@@ -504,39 +504,4 @@ function insert_post ($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new
$post_text_values = "$post_id, '$post_text'";
DB()->query("INSERT INTO ". BB_POSTS_TEXT ." ($post_text_columns) VALUES ($post_text_values)");
-}
-
-function topic_review ($topic_id)
-{
- global $bb_cfg, $template;
-
- // Fetch posts data
- $review_posts = DB()->fetch_rowset("
- SELECT
- p.*, h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
- IF(p.poster_id = ". GUEST_UID .", p.post_username, u.username) AS username, u.user_rank
- FROM ". BB_POSTS ." p
- LEFT JOIN ". BB_USERS ." u ON(u.user_id = p.poster_id)
- LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
- LEFT JOIN ". BB_POSTS_HTML ." h ON(h.post_id = p.post_id)
- WHERE p.topic_id = ". (int) $topic_id ."
- ORDER BY p.post_time DESC
- LIMIT ". $bb_cfg['posts_per_page'] ."
- ");
-
- // Topic posts block
- foreach ($review_posts as $i => $post)
- {
- $template->assign_block_vars('review', array(
- 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
- 'POSTER' => profile_url($post),
- 'POSTER_NAME_JS' => addslashes($post['username']),
- 'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']),
- 'MESSAGE' => get_parsed_post($post),
- ));
- }
-
- $template->assign_vars(array(
- 'TPL_TOPIC_REVIEW' => (bool) $review_posts,
- ));
}
\ No newline at end of file
diff --git a/library/language/en/main.php b/library/language/en/main.php
index 3c47ca715..da08859ea 100644
--- a/library/language/en/main.php
+++ b/library/language/en/main.php
@@ -279,8 +279,6 @@ $lang['MODERATE_TOPIC'] = 'Moderate this topic';
$lang['SELECT_POSTS_PER_PAGE'] = 'posts per page';
// Posting/Replying (Not private messaging!)
-$lang['TOPIC_REVIEW'] = 'Topic review';
-
$lang['NO_POST_MODE'] = 'No post mode selected'; // If posting.php is called without a mode (newtopic/reply/delete/etc, shouldn't be shown normaly)
$lang['POST_A_NEW_TOPIC'] = 'Post new topic';
diff --git a/library/language/ru/main.php b/library/language/ru/main.php
index 5dc0104a3..24e0b199b 100644
--- a/library/language/ru/main.php
+++ b/library/language/ru/main.php
@@ -279,8 +279,6 @@ $lang['MODERATE_TOPIC'] = 'Модерировать этот топик';
$lang['SELECT_POSTS_PER_PAGE'] = 'сообщ. на страницу';
// Posting/Replying (Not private messaging!)
-$lang['TOPIC_REVIEW'] = 'Обзор темы';
-
$lang['NO_POST_MODE'] = 'Не указан режим сообщения';
$lang['POST_A_NEW_TOPIC'] = 'Начать новую тему';
diff --git a/library/language/uk/main.php b/library/language/uk/main.php
index 798787607..ae9600695 100644
--- a/library/language/uk/main.php
+++ b/library/language/uk/main.php
@@ -279,8 +279,6 @@ $lang['MODERATE_TOPIC'] = 'Модерувати цей топік';
$lang['SELECT_POSTS_PER_PAGE'] = 'повідомл. на сторінку';
// Posting/Replying (Not private messaging!)
-$lang['TOPIC_REVIEW'] = 'Огляд теми';
-
$lang['NO_POST_MODE'] = 'Не вказано режим повідомлення';
$lang['POST_A_NEW_TOPIC'] = 'Почати нову тему';
diff --git a/posting.php b/posting.php
index a3d174127..fb693f640 100644
--- a/posting.php
+++ b/posting.php
@@ -6,11 +6,14 @@ require(BB_ROOT ."common.php");
require(INC_DIR .'bbcode.php');
require(INC_DIR .'functions_post.php');
+// Start session management
+$user->session_start();
+
$page_cfg['load_tpl_vars'] = array('post_icons');
-$submit = (bool) @$_REQUEST['post'];
-$preview = (bool) @$_REQUEST['preview'];
-$delete = (bool) @$_REQUEST['delete'];
+$submit = (bool) @$_REQUEST['post'];
+$preview = (bool) @$_REQUEST['preview'];
+$delete = (bool) @$_REQUEST['delete'];
$forum_id = (int) @$_REQUEST[POST_FORUM_URL];
$topic_id = (int) @$_REQUEST[POST_TOPIC_URL];
@@ -20,7 +23,6 @@ $mode = (string) @$_REQUEST['mode'];
$confirm = isset($_POST['confirm']);
-$refresh = $preview;
$orig_word = $replacement_word = array();
// Set topic type
@@ -40,8 +42,7 @@ if ($mode == 'smilies')
$tracking_topics = get_tracks('topic');
$tracking_forums = get_tracks('forum');
-// Start session management
-$user->session_start();
+
set_die_append_msg($forum_id, $topic_id);
@@ -261,7 +262,7 @@ if ($mode == 'new_rel')
}
// Notify
-if ($submit || $refresh)
+if ($submit || $preview)
{
$notify_user = (int) !empty($_POST['notify']);
}
@@ -317,23 +318,17 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
}
}
-// --------------------
-// What shall we do?
-//
-if ( ( $delete || $mode == 'delete' ) && !$confirm )
+// Confirm deletion
+if ($mode == 'delete' && !$confirm)
{
if (isset($_POST['cancel']))
{
redirect(POST_URL . "$post_id#$post_id");
}
- //
- // Confirm deletion
- //
$hidden_fields = array(
'p' => $post_id,
'mode' => 'delete',
);
-
print_confirmation(array(
'QUESTION' => $lang['CONFIRM_DELETE'],
'FORM_ACTION' => POSTING_URL,
@@ -353,11 +348,11 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
case 'editpost':
case 'newtopic':
case 'reply':
- $username = ( !empty($_POST['username']) ) ? clean_username($_POST['username']) : '';
- $subject = ( !empty($_POST['subject']) ) ? clean_title($_POST['subject']) : '';
- $message = ( !empty($_POST['message']) ) ? prepare_message($_POST['message']) : '';
+ $username = (!empty($_POST['username'])) ? clean_username($_POST['username']) : '';
+ $subject = (!empty($_POST['subject'])) ? clean_title($_POST['subject']) : '';
+ $message = (!empty($_POST['message'])) ? prepare_message($_POST['message']) : '';
$attach_rg_sig = (isset($_POST['attach_rg_sig']) && isset($_POST['poster_rg']) && $_POST['poster_rg'] != -1) ? 1 : 0;
- $poster_rg_id = (isset($_POST['poster_rg']) && $_POST['poster_rg'] != -1) ? (int) $_POST['poster_rg'] : 0;
+ $poster_rg_id = (isset($_POST['poster_rg']) && $_POST['poster_rg'] != -1) ? (int)$_POST['poster_rg'] : 0;
prepare_post($mode, $post_data, $error_msg, $username, $subject, $message);
@@ -459,7 +454,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
}
}
-if ($refresh || $error_msg || ($submit && $topic_has_new_posts))
+if ($preview || $error_msg || ($submit && $topic_has_new_posts))
{
$username = ( !empty($_POST['username']) ) ? clean_username($_POST['username']) : '';
$subject = ( !empty($_POST['subject']) ) ? clean_title($_POST['subject']) : '';
@@ -588,46 +583,9 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
if ( $topic_type_toggle != '' )
{
- $topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ' . $topic_type_toggle;
+ $topic_type_toggle = ' ' . $topic_type_toggle;
}
}
-//bt
-$topic_dl_type = (isset($post_info['topic_dl_type'])) ? $post_info['topic_dl_type'] : 0;
-
-if ($post_info['allow_reg_tracker'] && $post_data['first_post'] && ($topic_dl_type || $is_auth['auth_mod']))
-{
- $sql = "
- SELECT tor.attach_id
- FROM ". BB_POSTS ." p
- LEFT JOIN ". BB_BT_TORRENTS ." tor ON (p.post_id = tor.post_id)
- WHERE p.post_id = $post_id
- ";
- $result = DB()->fetch_row($sql);
- if (!empty($result['attach_id']))
- {
- if (!$topic_type_toggle)
- {
- $topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ';
- }
-
- $dl_ds = $dl_ch = $dl_hid = '';
- $dl_type_name = 'topic_dl_type';
- $dl_type_val = ($topic_dl_type) ? 1 : 0;
-
- if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod'])
- {
- $dl_ds = ' disabled="disabled" ';
- $dl_hid = '';
- $dl_type_name = '';
- }
-
- $dl_ch = ($mode == 'editpost' && $post_data['first_post'] && $topic_dl_type) ? ' checked="checked" ' : '';
-
- $topic_type_toggle .= '';
- $topic_type_toggle .= $dl_hid;
- }
-}
-//bt end
// Get poster release group data
if ($userdata['user_level'] == GROUP_MEMBER || IS_AM)
@@ -648,23 +606,25 @@ if ($userdata['user_level'] == GROUP_MEMBER || IS_AM)
}
}
-$hidden_form_fields = '';
+$hidden_fields = array(
+ 'mode' => $mode,
+ 'f' => $forum_id,
+ 't' => $topic_id,
+ 'p' => $post_id,
+);
-switch( $mode )
+switch ($mode)
{
case 'newtopic':
$page_title = $lang['POST_A_NEW_TOPIC'];
- $hidden_form_fields .= '';
break;
case 'reply':
$page_title = $lang['POST_A_REPLY'];
- $hidden_form_fields .= '';
break;
case 'editpost':
$page_title = $lang['EDIT_POST'];
- $hidden_form_fields .= '';
break;
}
@@ -675,35 +635,34 @@ $template->set_filenames(array(
'body' => 'posting.tpl',
));
-// Output the data to the template
$template->assign_vars(array(
'FORUM_NAME' => htmlCHR($forum_name),
'PAGE_TITLE' => $page_title,
'POSTING_TYPE_TITLE' => $page_title,
'POSTING_TOPIC_ID' => ($mode != 'newtopic') ? $topic_id : '',
'POSTING_TOPIC_TITLE' => ($mode != 'newtopic') ? wbr($post_info['topic_title']) : '',
- 'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id",
- 'USERNAME' => @$username,
'CAPTCHA_HTML' => (IS_GUEST) ? bb_captcha('get') : '',
- 'SUBJECT' => $subject,
- 'MESSAGE' => $message,
'POSTER_RGROUPS' => isset($poster_rgroups) && !empty($poster_rgroups) ? $poster_rgroups : '',
'ATTACH_RG_SIG' => ($switch_rg_sig) ? $switch_rg_sig : false,
-
- 'U_VIEWTOPIC' => ($mode == 'reply') ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&postorder=desc" : '',
-
- 'S_NOTIFY_CHECKED' => ($notify_user) ? 'checked="checked"' : '',
- 'S_TYPE_TOGGLE' => $topic_type_toggle,
- 'S_TOPIC_ID' => $topic_id,
- 'S_POST_ACTION' => POSTING_URL,
- 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields,
));
if ($mode == 'newtopic' || $post_data['first_post'])
{
- $template->assign_var('POSTING_SUBJECT');
+ $file_attached = !empty($post_info['attach_ext_id']);
+ $allowed_ext = $bb_cfg['attach']['allowed_ext'];
+
+ $template->assign_vars(array(
+ 'POSTING_SUBJECT' => true,
+ 'SHOW_ATTACH' => ($file_attached || $allowed_ext),
+ 'S_FORM_ENCTYPE' => 'enctype="multipart/form-data"',
+ 'FILE_ATTACHED' => $file_attached,
+ 'ATTACH_MAX_SIZE' => humn_size($bb_cfg['attach']['max_size']),
+ 'ALLOWED_EXT' => ($allowed_ext) ? '*.' . join(', *.', $allowed_ext) : 'прикреплять запрещено',
+ 'TOR_REQUIRED' => !empty($_POST['tor_required']),
+ 'POLL_TIP' => ($mode == 'newtopic') ? 'Вы сможете добавить опрос после создания темы' : 'Вы можете добавить опрос со страницы просмотра темы', // TODO
+ ));
}
// Update post time
@@ -715,11 +674,21 @@ if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post'])
));
}
-// Topic review
-if( $mode == 'reply' && $is_auth['auth_read'] )
-{
- topic_review($topic_id);
-}
+// Output the data to the template
+$template->assign_vars(array(
+ 'SUBJECT' => $subject,
+ 'MESSAGE' => $message,
+ 'AUTH_MOD' => $is_auth['auth_mod'],
+
+ 'U_VIEWTOPIC' => ($mode == 'reply') ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id" : '',
+ 'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id",
+
+ 'S_NOTIFY_CHECKED' => ($notify_user) ? 'checked="checked"' : '',
+ 'S_TYPE_TOGGLE' => $topic_type_toggle,
+ 'S_TOPIC_ID' => $topic_id,
+ 'S_POST_ACTION' => POSTING_URL,
+ 'S_HIDDEN_FORM_FIELDS' => build_hidden_fields($hidden_fields),
+));
require(PAGE_HEADER);
diff --git a/styles/images/smiles/ad.gif b/styles/images/smiles/cd.gif
similarity index 100%
rename from styles/images/smiles/ad.gif
rename to styles/images/smiles/cd.gif
diff --git a/styles/templates/default/posting.tpl b/styles/templates/default/posting.tpl
index 6711d588b..af3ccafd5 100644
--- a/styles/templates/default/posting.tpl
+++ b/styles/templates/default/posting.tpl
@@ -56,10 +56,9 @@
» {POSTING_TOPIC_TITLE}
-
-
-
+
+
-
+
-
-
- {L_TOPIC_REVIEW} |
-
-
- {L_AUTHOR} |
- {L_MESSAGE} |
-
-
-
-
-
- {review.POSTER}
-
- 
- |
-
- {MINIPOST_IMG} {review.POST_DATE}
- {review.MESSAGE}
- |
-
-
+
-
+
-
+
-
-
\ No newline at end of file
+
+
\ No newline at end of file