Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / news_edit_page.php
blobfc9eb51ba42debd00d81108f07ddc079fd99b955
1 <?php
2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * @package MantisBT
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses core.php
24 * @uses access_api.php
25 * @uses config_api.php
26 * @uses current_user_api.php
27 * @uses form_api.php
28 * @uses gpc_api.php
29 * @uses helper_api.php
30 * @uses html_api.php
31 * @uses lang_api.php
32 * @uses news_api.php
33 * @uses print_api.php
34 * @uses project_api.php
35 * @uses string_api.php
38 require_once( 'core.php' );
39 require_api( 'access_api.php' );
40 require_api( 'config_api.php' );
41 require_api( 'current_user_api.php' );
42 require_api( 'form_api.php' );
43 require_api( 'gpc_api.php' );
44 require_api( 'helper_api.php' );
45 require_api( 'html_api.php' );
46 require_api( 'lang_api.php' );
47 require_api( 'news_api.php' );
48 require_api( 'print_api.php' );
49 require_api( 'project_api.php' );
50 require_api( 'string_api.php' );
52 news_ensure_enabled();
54 $f_news_id = gpc_get_int( 'news_id' );
55 $f_action = gpc_get_string( 'action', '' );
57 # If deleting item redirect to delete script
58 if ( 'delete' == $f_action ) {
59 form_security_validate( 'news_delete' );
61 $row = news_get_row( $f_news_id );
63 # This check is to allow deleting of news items that were left orphan due to bug #3723
64 if ( project_exists( $row['project_id'] ) ) {
65 access_ensure_project_level( config_get( 'manage_news_threshold' ), $row['project_id'] );
68 helper_ensure_confirmed( lang_get( 'delete_news_sure_msg' ), lang_get( 'delete_news_item_button' ) );
70 news_delete( $f_news_id );
72 form_security_purge( 'news_delete' );
74 print_header_redirect( 'news_menu_page.php', true );
77 # Retrieve news item data and prefix with v_
78 $row = news_get_row( $f_news_id );
79 if ( $row ) {
80 extract( $row, EXTR_PREFIX_ALL, 'v' );
83 access_ensure_project_level( config_get( 'manage_news_threshold' ), $v_project_id );
85 $v_headline = string_attribute( $v_headline );
86 $v_body = string_textarea( $v_body );
88 html_page_top( lang_get( 'edit_news_title' ) );
90 # Edit News Form BEGIN
92 <br />
93 <div align="center">
94 <form method="post" action="news_update.php">
95 <?php echo form_security_field( 'news_update' ); ?>
96 <table class="width75" cellspacing="1">
97 <tr>
98 <td class="form-title">
99 <input type="hidden" name="news_id" value="<?php echo $v_id ?>" />
100 <?php echo lang_get( 'headline' ) ?>
101 </td>
102 <td class="right">
103 <?php print_bracket_link( 'news_menu_page.php', lang_get( 'go_back' ) ) ?>
104 </td>
105 </tr>
106 <tr class="row-1">
107 <td class="category" width="25%">
108 <span class="required">*</span><?php echo lang_get( 'headline' ) ?>
109 </td>
110 <td width="75%">
111 <input type="text" name="headline" size="64" maxlength="64" value="<?php echo $v_headline ?>" />
112 </td>
113 </tr>
114 <tr class="row-2">
115 <td class="category">
116 <span class="required">*</span><?php echo lang_get( 'body' ) ?>
117 </td>
118 <td>
119 <textarea name="body" cols="60" rows="10"><?php echo $v_body ?></textarea>
120 </td>
121 </tr>
122 <tr class="row-1">
123 <td class="category">
124 <?php echo lang_get( 'post_to' ) ?>
125 </td>
126 <td>
127 <select name="project_id">
128 <?php
129 $t_sitewide = false;
130 if ( current_user_is_administrator() ) {
131 $t_sitewide = true;
133 print_project_option_list( $v_project_id, $t_sitewide );
135 </select>
136 </td>
137 </tr>
138 <tr class="row-2">
139 <td class="category">
140 <?php echo lang_get( 'announcement' ) ?><br />
141 <span class="small"><?php echo lang_get( 'stays_on_top' ) ?></span>
142 </td>
143 <td>
144 <input type="checkbox" name="announcement" <?php check_checked( $v_announcement, 1 ); ?> />
145 </td>
146 </tr>
147 <tr class="row-1">
148 <td class="category" width="25%">
149 <?php echo lang_get( 'view_status' ) ?>
150 </td>
151 <td width="75%">
152 <select name="view_state">
153 <?php print_enum_string_option_list( 'view_state', $v_view_state ) ?>
154 </select>
155 </td>
156 </tr>
157 <tr>
158 <td>
159 <span class="required">* <?php echo lang_get( 'required' ) ?></span>
160 </td>
161 <td class="center">
162 <input type="submit" class="button" value="<?php echo lang_get( 'update_news_button' ) ?>" />
163 </td>
164 </tr>
165 </table>
166 </form>
167 </div>
168 <?php
169 # Edit News Form END
171 html_page_bottom();