xntx
хнотик-багоискатель | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору Xomozg а, все, понял Код: ############################################################## ## MOD Title: Topic Description ## MOD Author: Morpheus2matrix < morpheus2matrix@caramail.com > - Lebrun Thomas - http://morpheus.2037.biz ## MOD Description: This MOD allow you to add a little description of the topic that you have posted ## MOD Version: 0.9.1 ## Installation Level: Easy ## Installation Time: 10 min ## Files to Edit: posting.php, ## functions_post.php, ## viewforum.php, ## lang_main.php, ## posting_body.tpl, ## viewforum_body.tpl ## Included Files: ## ## History : ## 0.9.0. - Initial BETA release ## 0.9.1. - Now the Topic Desciption field appear only for a new topic ## 0.9.5. - Rewriting with a correct MOD Template ## ######################################################## ## This MOD is released under the GPL License. ## Intellectual Property is retained by the MOD Author(s) listed above ############################################################## ## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ ############################################################## ## Author Notes: ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ SQL ]------------------------------------------ # remplace phpbb_ by the prefix of your tables ALTER TABLE phpbb_topics ADD topic_desc varchar(255) DEFAULT '' AFTER topic_title # #-----[ OPEN ]------------------------------------------ # posting.php # #-----[ FIND ]------------------------------------------ # $select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig" : ''; # #-----[ IN LINE FIND ]------------------------------------------ # t.topic_title, # #-----[ IN LINE AFTER ADD ]------------------------------------------ # t.topic_desc, # #-----[ FIND ]------------------------------------------ # $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : ''; # #-----[ AFTER, ADD ]------------------------------------------ # $topic_desc = ( !empty($HTTP_POST_VARS['topic_desc']) ) ? trim($HTTP_POST_VARS['topic_desc']) : ''; # #-----[ FIND ]------------------------------------------ # prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length); # #-----[ IN LINE FIND ]------------------------------------------ # $poll_length # #-----[ IN LINE AFTER, ADD ]------------------------------------------ # , $topic_desc # #-----[ FIND ]------------------------------------------ # submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length); # #-----[ IN LINE FIND ]------------------------------------------ # $poll_length # #-----[ IN LINE AFTER, ADD ]------------------------------------------ # , str_replace("\'", "''", $topic_desc) # #-----[ FIND ]------------------------------------------ # else if ( $mode == 'quote' || $mode == 'editpost' ) { $subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject']; $message = $post_info['post_text']; # #-----[ AFTER, ADD ]------------------------------------------ # $topic_desc = $post_info['topic_desc']; # #-----[ FIND ]------------------------------------------ # // // This enables the forum/topic title to be output for posting // but not for privmsg (where it makes no sense) // $template->assign_block_vars('switch_not_privmsg', array()); # #-----[ AFTER, ADD ]------------------------------------------ # // // Enable the Topic Description MOD only if this is a new post // or if you edit the fist post of a topic // if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) { $template->assign_block_vars('topic_description', array()); } # #-----[ FIND ]------------------------------------------ # 'L_STYLES_TIP' => $lang['Styles_tip'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_TOPIC_DESCRIPTION' => $lang['Topic_description'], # #-----[ FIND ]------------------------------------------ # 'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? append_sid("posting.$phpEx?mode=topicreview&" . POST_TOPIC_URL . "=$topic_id") : '', # #-----[ AFTER, ADD ]------------------------------------------ # 'TOPIC_DESCRIPTION' => $topic_desc, # #-----[ OPEN ]------------------------------------------ # functions_post.php # #-----[ FIND ]------------------------------------------ # function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$username, &$bbcode_uid, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length) # #-----[ IN LINE FIND ]------------------------------------------ # &$poll_length # #-----[ IN LINE AFTER, ADD ]------------------------------------------ # , &$topic_desc # #-----[ FIND ]------------------------------------------ # // Check subject if ( !empty($subject) ) { $subject = htmlspecialchars(trim($subject)); } else if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) { $error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject']; } # #-----[ AFTER, ADD ]------------------------------------------ # // Check Topic Desciption if ( !empty($topic_desc) ) { $topic_desc = htmlspecialchars(trim($topic_desc)); } # #-----[ FIND ]------------------------------------------ # function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length) # #-----[ IN LINE FIND ]------------------------------------------ # &$poll_length # #-----[ IN LINE AFTER, ADD ]------------------------------------------ # , &$topic_desc # #-----[ FIND ]------------------------------------------ # $sql = ( $mode != "editpost" ) ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_vote = $topic_vote WHERE topic_id = $topic_id"; # #-----[ IN LINE FIND ]------------------------------------------ # "INSERT INTO " . TOPICS_TABLE . " (topic_title, # #-----[ IN LINE AFTER, ADD ]------------------------------------------ # topic_desc, # #-----[ IN LINE FIND ]------------------------------------------ # VALUES ('$post_subject', # #-----[ IN LINE AFTER, ADD ]------------------------------------------ # '$topic_desc', # #-----[ IN LINE FIND ]------------------------------------------ # "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', # #-----[ IN LINE AFTER, ADD ]------------------------------------------ # topic_desc = '$topic_desc', # #-----[ OPEN ]------------------------------------------ # viewforum.php # #-----[ FIND ]------------------------------------------ # include($phpbb_root_path . 'common.'.$phpEx); # #-----[ AFTER, ADD ]------------------------------------------ # include($phpbb_root_path . 'includes/bbcode.'.$phpEx); # #-----[ FIND ]------------------------------------------ # 'L_AUTHOR' => $lang['Author'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_DESCRIPTION' => $lang['Description'], # #-----[ FIND ]------------------------------------------ # $views = $topic_rowset[$i]['topic_views']; # #-----[ AFTER, ADD ]------------------------------------------ # if ( $topic_rowset[$i]['topic_desc'] == '' ) { $topic_desc = $lang['No_topic_description']; } else { $topic_desc = $topic_rowset[$i]['topic_desc']; } # #-----[ FIND ]------------------------------------------ # 'LAST_POST_IMG' => $last_post_url, # #-----[ AFTER, ADD ]------------------------------------------ # 'TOPIC_DESCRIPTION' => smilies_pass($topic_desc), # #-----[ OPEN ]------------------------------------------ # lang_main.php # #-----[ FIND ]------------------------------------------ # // // That's all folk // # #-----[ BEFORE, ADD ]------------------------------------------ # $lang['Topic_description'] = 'Description of your topic'; $lang['No_topic_description'] = 'There is no topic description'; $lang['Description'] = 'Topic Description'; # #-----[ OPEN ]------------------------------------------ # posting_body.tpl # #-----[ FIND ]------------------------------------------ # <tr> <td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td> <td class="row2" width="78%"> <span class="gen"> <input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" /> </span> </td> </tr> # #-----[ AFTER, ADD ]------------------------------------------ # <!-- BEGIN topic_description --> <tr> <td class="row1" width="22%"><span class="gen"><b>{L_TOPIC_DESCRIPTION}</b></span></td> <td class="row2" width="78%"> <span class="gen"> <input type="text" name="topic_desc" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{TOPIC_DESCRIPTION}" /> </span> </td> </tr> <!-- END topic_description --> # #-----[ OPEN ]------------------------------------------ # viewforum_body.tpl # #-----[ FIND ]------------------------------------------ # {topicrow.TOPIC_TITLE}</a></span><span class="gensmall"> # #-----[ AFTER, ADD ]------------------------------------------ # <br />{L_DESCRIPTION} : {topicrow.TOPIC_DESCRIPTION} # #-----[ SAVE/CLOSE ALL FILES ]---------------------------------------- # # EoM | ЗЫ: гумманоид давал...
|