diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index 39159af8b..c504b4165 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -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', diff --git a/upload/ajax/edit_group_profile.php b/upload/ajax/edit_group_profile.php index 52ca3c502..bc9a4f453 100644 --- a/upload/ajax/edit_group_profile.php +++ b/upload/ajax/edit_group_profile.php @@ -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; diff --git a/upload/group_config.php b/upload/group_config.php index 4df9850ce..831c1462f 100644 --- a/upload/group_config.php +++ b/upload/group_config.php @@ -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, diff --git a/upload/includes/functions_post.php b/upload/includes/functions_post.php index 04129124c..4fae0ee6f 100644 --- a/upload/includes/functions_post.php +++ b/upload/includes/functions_post.php @@ -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'); diff --git a/upload/language/en/main.php b/upload/language/en/main.php index 974fa5801..714b543c1 100644 --- a/upload/language/en/main.php +++ b/upload/language/en/main.php @@ -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 // diff --git a/upload/language/ru/main.php b/upload/language/ru/main.php index 68da460a0..cd140982d 100644 --- a/upload/language/ru/main.php +++ b/upload/language/ru/main.php @@ -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 // diff --git a/upload/language/ua/main.php b/upload/language/ua/main.php index 3bde9dcf0..fb5b9cd84 100644 --- a/upload/language/ua/main.php +++ b/upload/language/ua/main.php @@ -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 // diff --git a/upload/posting.php b/upload/posting.php index 82b42e45c..57a8bf5dd 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -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 .= ''; + } +} + $hidden_form_fields = ''; 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&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&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']) diff --git a/upload/templates/default/group_config.tpl b/upload/templates/default/group_config.tpl index 7e45ddfec..4e0b646f5 100644 --- a/upload/templates/default/group_config.tpl +++ b/upload/templates/default/group_config.tpl @@ -27,16 +27,28 @@ function manage_group(mode, value) {
- +
+ +
++ + +
+{L_OPTIONS}
+{L_OPTIONS}:
{L_RELEASE_FROM_RG}: | |
{postrow.RG_AVATAR} | +{postrow.RG_NAME} |
+