+ Добавлена возможность указать от какой релиз группы создана раздача
+ Добавлена возможность присоединить подпись релиз группы при создании раздачи
+ Добавленна подпись релиз группы

Необходимый SQL запрос:

ALTER TABLE  `bb_posts` ADD  `poster_rg_id` mediumint(8) NOT NULL DEFAULT '0'
      ADD  `attach_poster_rg_sig` tinyint(4) NOT NULL DEFAULT '0';
ALTER TABLE  `bb_posts` ADD  `group_signature` text NOT NULL DEFAULT '';

Signed-off-by: Dark Nightmare <gtdarknightmare@gmail.com>
This commit is contained in:
Dark Nightmare 2014-08-05 00:45:47 +06:00
commit 090b886dc1
12 changed files with 134 additions and 34 deletions

View file

@ -794,6 +794,7 @@ CREATE TABLE IF NOT EXISTS `bb_groups` (
`release_group` tinyint(4) NOT NULL DEFAULT '0',
`group_name` varchar(40) NOT NULL DEFAULT '',
`group_description` text NOT NULL DEFAULT '',
`group_signature` text NOT NULL DEFAULT '',
`group_moderator` mediumint(8) NOT NULL DEFAULT '0',
`group_single_user` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`group_id`),
@ -864,6 +865,8 @@ CREATE TABLE IF NOT EXISTS `bb_posts` (
`poster_id` mediumint(8) NOT NULL DEFAULT '0',
`post_time` int(11) NOT NULL DEFAULT '0',
`poster_ip` char(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`poster_rg_id` mediumint(8) NOT NULL DEFAULT '0',
`attach_poster_rg_sig` tinyint(4) NOT NULL DEFAULT '0',
`post_username` varchar(25) NOT NULL DEFAULT '',
`post_edit_time` int(11) NOT NULL DEFAULT '0',
`post_edit_count` smallint(5) unsigned NOT NULL DEFAULT '0',

View file

@ -6,27 +6,28 @@ global $bb_cfg, $userdata, $lang;
if (!$group_id = intval($this->request['group_id']) OR !$group_info = get_group_data($group_id))
{
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
}
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('No mode specified');
$this->ajax_die('No mode specified');
}
$value = $this->request['value'] = (string) (isset($this->request['value'])) ? $this->request['value'] : 0;
if (!IS_ADMIN && $userdata['user_id'] != $group_info['group_moderator'])
{
$this->ajax_die($lang['ONLY_FOR_MOD']);
$this->ajax_die($lang['ONLY_FOR_MOD']);
}
switch ($mode)
{
case 'group_name':
case 'group_description':
$value = htmlCHR($value);
$this->response['new_value'] = $value;
break;
case 'group_name':
case 'group_signature':
case 'group_description':
$value = htmlCHR($value);
$this->response['new_value'] = $value;
break;
case 'group_type':
$this->response['new_value'] = $value;

View file

@ -79,6 +79,7 @@ if ($is_moderator)
'GROUP_NAME' => htmlCHR($group_info['group_name']),
'GROUP_ID' => $group_id,
'GROUP_DESCRIPTION' => htmlCHR($group_info['group_description']),
'GROUP_SIGNATURE' => htmlCHR($group_info['group_signature']),
'U_GROUP_URL' => GROUP_URL . $group_id,
'GROUP_TYPE' => $group_type,
'S_GROUP_OPEN_TYPE' => GROUP_OPEN,

View file

@ -69,7 +69,7 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
//
// Post a new topic/reply or edit existing post/poll
//
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, $post_username, $post_subject, $post_message, $update_post_time)
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, $post_username, $post_subject, $post_message, $update_post_time, $poster_rg_id, $attach_poster_rg_sig)
{
global $userdata, $post_info, $is_auth, $bb_cfg, $lang, $datastore;
@ -154,7 +154,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
}
}
$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1" : "";
if ($update_post_time && $mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post'])
{
@ -163,7 +163,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
DB()->sql_query("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, poster_rg_id, attach_poster_rg_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '". USER_IP ."', $poster_rg_id, $attach_poster_rg_sig)" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . ", poster_rg_id = $poster_rg_id, attach_poster_rg_sig = $attach_poster_rg_sig WHERE post_id = $post_id";
if (!DB()->sql_query($sql))
{
bb_die('Error in posting #2');

View file

@ -773,6 +773,12 @@ $lang['UNSUBSCRIBE_GROUP'] = 'Unsubscribe';
$lang['VIEW_INFORMATION'] = 'View Information';
$lang['MEMBERS_IN_GROUP'] = 'Members in group';
// Release Groups
$lang['POST_RELEASE_FROM_GROUP'] = 'Post release from group';
$lang['CHOOSE_RELEASE_GROUP'] = 'Select release group';
$lang['ATTACH_RG_SIG'] = 'Attach release group signature';
$lang['RELEASE_FROM_RG'] = 'Release was prepared by';
//
// Search
//

View file

@ -773,6 +773,12 @@ $lang['UNSUBSCRIBE_GROUP'] = 'Выйти из группы';
$lang['VIEW_INFORMATION'] = 'Просмотреть информацию';
$lang['MEMBERS_IN_GROUP'] = 'Кол-во участников';
// Release Groups
$lang['POST_RELEASE_FROM_GROUP'] = 'Создать релиз от группы';
$lang['CHOOSE_RELEASE_GROUP'] = 'Выбрать релиз группу';
$lang['ATTACH_RG_SIG'] = 'Добавить подпись релиз группы';
$lang['RELEASE_FROM_RG'] = 'Релиз подготовлен';
//
// Search
//

View file

@ -773,6 +773,12 @@ $lang['UNSUBSCRIBE_GROUP'] = 'Вийти з групи';
$lang['VIEW_INFORMATION'] = 'Переглянути інформацію';
$lang['MEMBERS_IN_GROUP'] = 'Кількість учасників';
// Release Groups
$lang['POST_RELEASE_FROM_GROUP'] = 'Создать релиз от группы';
$lang['CHOOSE_RELEASE_GROUP'] = 'Выбрать релиз группу';
$lang['ATTACH_RG_SIG'] = 'Добавить подпись релиз группы';
$lang['RELEASE_FROM_RG'] = 'Релиз подготовлен';
//
// Search
//

View file

@ -29,6 +29,8 @@ $orig_word = $replacement_word = array();
$topic_type = (@$_POST['topictype']) ? (int) $_POST['topictype'] : POST_NORMAL;
$topic_type = in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE)) ? $topic_type : POST_NORMAL;
$selected_rg = 0;
if ($mode == 'smilies')
{
generate_smilies('window');
@ -178,6 +180,9 @@ if ($post_info = DB()->fetch_row($sql))
$post_data['topic_type'] = $post_info['topic_type'];
$post_data['poster_id'] = $post_info['poster_id'];
$selected_rg = $post_info['poster_rg_id'];
$switch_poster_rg_sig = ($post_info['attach_poster_rg_sig']) ? true : false;
// Can this user edit/delete the post?
if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'])
{
@ -361,6 +366,8 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
$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_poster_rg_sig = (isset($_POST['attach_poster_rg_sig']) && isset($_POST['poster_release_group']) && $_POST['poster_release_group'] != -1) ? 1 : 0;
$poster_rg_id = (isset($_POST['poster_release_group']) && $_POST['poster_release_group'] != -1) ? (int) $_POST['poster_release_group'] : 0;
prepare_post($mode, $post_data, $error_msg, $username, $subject, $message);
@ -368,7 +375,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
{
$topic_type = ( isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type;
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), $update_post_time);
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), $update_post_time, $poster_rg_id, $attach_poster_rg_sig);
$post_url = POST_URL ."$post_id#$post_id";
$post_msg = ($mode == 'editpost') ? $lang['EDITED']: $lang['STORED'];
@ -630,6 +637,25 @@ if ($post_info['allow_reg_tracker'] && $post_data['first_post'] && ($topic_dl_ty
}
//bt end
// Get poster release group data
if ($userdata['user_level'] == GROUP_MEMBER || IS_AM)
{
$poster_release_groups = '';
$sql = "SELECT ug.group_id, g.group_name, g.release_group
FROM ". BB_USER_GROUP ." ug
INNER JOIN ". BB_GROUPS ." g ON(g.group_id = ug.group_id)
WHERE ug.user_id = {$userdata['user_id']}
AND g.release_group = 1
ORDER BY g.group_name";
foreach (DB()->fetch_rowset($sql) as $row)
{
$selected_opt = ($row['group_id'] == $selected_rg) ? 'selected' : '';
$poster_release_groups .= '<option value="'. $row['group_id'] .'" '. $selected_opt .'>'. $row['group_name'] .'</option>';
}
}
$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
switch( $mode )
@ -659,25 +685,28 @@ $template->set_filenames(array(
// 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",
'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) ? CAPTCHA()->get_html() : '',
'SUBJECT' => $subject,
'MESSAGE' => $message,
'USERNAME' => @$username,
'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '',
'SUBJECT' => $subject,
'MESSAGE' => $message,
'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '',
'POSTER_RELEASE_GROUPS' => ($poster_release_groups) ? $poster_release_groups : '',
'ATTACH_POSTER_RG_SIG' => $switch_poster_rg_sig,
'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,
'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;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'])

View file

@ -27,16 +27,28 @@ function manage_group(mode, value) {
</tr>
<tr>
<td>{L_GROUP_DESCRIPTION}:</td>
<td><div id="preview"></div>
<td><div id="preview_description"></div>
<p>
<textarea cols="80" id="group_description" rows="6" >{GROUP_DESCRIPTION}</textarea>
</p>
<p>
<input type="button" value="{L_AJAX_PREVIEW}" onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#group_description').val()});ajax.callback.posts=function(data){$('div#preview').html(data.message_html);initPostBBCode('div#preview')}">
<input type="button" value="{L_AJAX_PREVIEW}" onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#group_description').val()});ajax.callback.posts=function(data){$('div#preview_description').html(data.message_html);initPostBBCode('div#preview_description')}">
<input type="button" value="{L_SAVE}" onclick="javascript:manage_group('group_description',$('textarea#group_description').val())">
</p>
</td>
</tr>
<tr>
<td>{L_SIGNATURE}:</td>
<td><div id="preview_signature"></div>
<p>
<textarea cols="80" id="group_signature" rows="3" >{GROUP_SIGNATURE}</textarea>
</p>
<p>
<input type="button" value="{L_AJAX_PREVIEW}" onclick="ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#group_signature').val()});ajax.callback.posts=function(data){$('div#preview_signature').html(data.message_html);initPostBBCode('div#preview_signature')}">
<input type="button" value="{L_SAVE}" onclick="javascript:manage_group('group_signature',$('textarea#group_signature').val())">
</p>
</td>
</tr>
<tr>
<td>{L_GROUP_TYPE}:</td>
<td>

View file

@ -116,7 +116,7 @@
<!-- ELSEIF LOGGED_IN -->
<tr>
<td class="row1 vTop pad_4" valign="top">
<p><b>{L_OPTIONS}</b></p>
<p><b>{L_OPTIONS}:</b></p>
</td>
<td class="row2">
<div class="floatL">
@ -138,14 +138,26 @@
</td>
</tr>
<!-- ENDIF / LOGGED_IN -->
<!-- IF ATTACHBOX -->
<tr>
<td><b>{L_POST_RELEASE_FROM_GROUP}:</b></td>
<td>
<select name="poster_release_group">
<option value="-1">{L_CHOOSE_RELEASE_GROUP}</option>
{POSTER_RELEASE_GROUPS}
</select>
<label><input type="checkbox" name="attach_poster_rg_sig" <!-- IF ATTACH_POSTER_RG_SIG -->checked<!-- ENDIF -->/> {L_ATTACH_RG_SIG}</label>
</td>
</tr>
<!-- ENDIF -->
<!-- BEGIN switch_type_toggle -->
<tr>
<td colspan="2" class="row2 tCenter pad_6">{S_TYPE_TOGGLE}</td>
</tr>
<!-- END switch_type_toggle -->
<!-- IF ATTACHBOX --><!-- INCLUDE posting_attach.tpl --><!-- ENDIF -->
</table>
</form>

View file

@ -408,6 +408,18 @@ function build_poll_add_form (src_el)
<div class="post_wrap">
<span id="pe_{postrow.POST_ID}"></span>
<span id="pp_{postrow.POST_ID}">{postrow.MESSAGE}</span>
<!-- IF postrow.RG_NAME -->
<div align="center">
<table id="pg_{postrow.POST_ID}" style="border:1px solid #DEDEDE;border-left:4px solid #DEDEDE;">
<tr><td colspan="2" align="left" valign="middle" style="border-bottom:1px solid #DEDEDE;padding:5px;" class="genmed bold">{L_RELEASE_FROM_RG}:</td></tr>
<tr>
<td style="padding:5px;">{postrow.RG_AVATAR}</td>
<td align="left" valign="top" style="padding:5px;"><a href="RG_URL" class="med bold"><h2>{postrow.RG_NAME}</h2></a></td>
</tr>
</table>
</div>
<!-- ENDIF -->
<!-- IF postrow.RG_SIG --><div id="rg_sig">{postrow.RG_SIG}</div><!-- ENDIF -->
<div id="pc_{postrow.POST_ID}" <!-- IF not postrow.MC_COMMENT -->style="display: none;"<!-- ENDIF -->>
<div id="mc_class_{postrow.POST_ID}" class="alert alert-{postrow.MC_CLASS}" style="width: 92%;">
<h4 class="alert-heading">{postrow.MC_TITLE}</h4><hr />

View file

@ -363,7 +363,7 @@ if ($t_data['topic_show_first_post'] && $start)
u.user_regdate, u.user_sig,
u.avatar_ext_id,
u.user_opt, u.user_gender, u.user_birthday,
p.*,
p.*, g.group_name, g.group_id, g.group_signature, g.avatar_ext_id as rg_avatar_id,
u2.username as mc_username, u2.user_rank as mc_user_rank,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
FROM ". BB_POSTS ." p
@ -371,6 +371,7 @@ if ($t_data['topic_show_first_post'] && $start)
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)
LEFT JOIN ". BB_USERS ." u2 ON(u2.user_id = p.mc_user_id)
LEFT JOIN ". BB_GROUPS ." g ON(g.group_id = p.poster_rg_id)
WHERE
p.post_id = {$t_data['topic_first_post_id']}
LIMIT 1
@ -383,7 +384,7 @@ $sql = "
u.user_regdate, u.user_sig,
u.avatar_ext_id,
u.user_opt, u.user_gender, u.user_birthday,
p.*,
p.*, g.group_name, g.group_id, g.group_signature, g.avatar_ext_id as rg_avatar_id,
u2.username as mc_username, u2.user_rank as mc_user_rank,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
FROM ". BB_POSTS ." p
@ -391,6 +392,7 @@ $sql = "
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)
LEFT JOIN ". BB_USERS ." u2 ON(u2.user_id = p.mc_user_id)
LEFT JOIN ". BB_GROUPS ." g ON(g.group_id = p.poster_rg_id)
WHERE p.topic_id = $topic_id
$limit_posts_time
GROUP BY p.post_id
@ -690,6 +692,11 @@ for($i = 0; $i < $total_posts; $i++)
$mc_comment = $postrow[$i]['mc_comment'];
$mc_user_id = profile_url(array('username' => $postrow[$i]['mc_username'], 'user_id' => $postrow[$i]['mc_user_id'], 'user_rank' => $postrow[$i]['mc_user_rank']));
$rg_id = ($postrow[$i]['poster_rg_id']) ? $postrow[$i]['poster_rg_id'] : 0;
$rg_avatar = get_avatar(GROUP_AVATAR_MASK . $rg_id, $postrow[$i]['rg_avatar_id'], true, 100, 100);
$rg_name = ($postrow[$i]['group_name']) ? htmlCHR($postrow[$i]['group_name']) : '';
$rg_signature = ($postrow[$i]['group_signature']) ? bbcode2html(htmlCHR($postrow[$i]['group_signature'])) : '';
$poster_avatar = '';
if ( !$user->opt_js['h_av'] && $poster_id != GUEST_UID )
{
@ -872,6 +879,11 @@ for($i = 0; $i < $total_posts; $i++)
'MC_CLASS' => $mc_class,
'MC_TITLE' => sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id),
'MC_SELECT_TYPE' => build_select("mc_type_$post_id", array_flip($mc_select_type), $mc_type),
'RG_AVATAR' => $rg_avatar,
'RG_NAME' => $rg_name,
'RG_URL' => GROUP_URL . $rg_id,
'RG_SIG' => $rg_signature,
));
if ($postrow[$i]['post_attachment'] && $is_auth['auth_download'] && function_exists('display_post_attachments'))