Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / tag_view_page.php
blob45ee755e36293fbe2affd90386aff31262045989
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) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
20 * @link http://www.mantisbt.org
22 * @uses core.php
23 * @uses access_api.php
24 * @uses authentication_api.php
25 * @uses compress_api.php
26 * @uses config_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 print_api.php
33 * @uses string_api.php
34 * @uses tag_api.php
35 * @uses user_api.php
38 require_once( 'core.php' );
39 require_api( 'access_api.php' );
40 require_api( 'authentication_api.php' );
41 require_api( 'compress_api.php' );
42 require_api( 'config_api.php' );
43 require_api( 'form_api.php' );
44 require_api( 'gpc_api.php' );
45 require_api( 'helper_api.php' );
46 require_api( 'html_api.php' );
47 require_api( 'lang_api.php' );
48 require_api( 'print_api.php' );
49 require_api( 'string_api.php' );
50 require_api( 'tag_api.php' );
51 require_api( 'user_api.php' );
53 access_ensure_global_level( config_get( 'tag_view_threshold' ) );
54 compress_enable();
56 $f_tag_id = gpc_get_int( 'tag_id' );
57 $t_tag_row = tag_get( $f_tag_id );
59 $t_name = string_display_line( $t_tag_row['name'] );
60 $t_description = string_display( $t_tag_row['description'] );
62 html_page_top( sprintf( lang_get( 'tag_details' ), $t_name ) );
65 <br/>
66 <table class="width100" cellspacing="1">
68 <!-- Title -->
69 <tr>
70 <td class="form-title" colspan="2">
71 <?php echo sprintf( lang_get( 'tag_details' ), $t_name ) ?>
73 </td>
74 <td class="right" colspan="3">
75 <?php print_bracket_link( 'search.php?tag_string='.urlencode($t_tag_row['name']), sprintf( lang_get( 'tag_filter_default' ), tag_stats_attached( $f_tag_id ) ) ); ?>
76 </td>
77 </tr>
79 <!-- Info -->
80 <tr class="row-category">
81 <td width="15%"><?php echo lang_get( 'tag_id' ) ?></td>
82 <td width="25%"><?php echo lang_get( 'tag_name' ) ?></td>
83 <td width="20%"><?php echo lang_get( 'tag_creator' ) ?></td>
84 <td width="20%"><?php echo lang_get( 'tag_created' ) ?></td>
85 <td width="20%"><?php echo lang_get( 'tag_updated' ) ?></td>
86 </tr>
88 <tr <?php echo helper_alternate_class() ?>>
89 <td><?php echo $t_tag_row['id'] ?></td>
90 <td><?php echo $t_name ?></td>
91 <td><?php echo string_display_line( user_get_name($t_tag_row['user_id']) ) ?></td>
92 <td><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_created'] ) ?> </td>
93 <td><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_updated'] ) ?> </td>
94 </tr>
96 <!-- spacer -->
97 <tr class="spacer">
98 <td colspan="5"></td>
99 </tr>
101 <!-- Description -->
102 <tr <?php echo helper_alternate_class() ?>>
103 <td class="category"><?php echo lang_get( 'tag_description' ) ?></td>
104 <td colspan="4"><?php echo $t_description ?></td>
105 </tr>
107 <!-- Statistics -->
108 <?php
109 $t_tags_related = tag_stats_related( $f_tag_id );
110 if ( count( $t_tags_related ) ) {
111 echo '<tr ',helper_alternate_class(),'>';
112 echo '<td class="category" rowspan="',count( $t_tags_related ),'">',lang_get( 'tag_related' ),'</td>';
114 $i = 0;
115 foreach( $t_tags_related as $t_tag ) {
116 $t_name = string_display_line( $t_tag['name'] );
117 $t_description = string_display_line( $t_tag['description'] );
118 $t_count = $t_tag['count'];
120 echo ( $i > 0 ? '<tr '.helper_alternate_class().'>' : '' );
121 echo "<td><a href='tag_view_page.php?tag_id=$t_tag[id]' title='$t_description'>$t_name</a></td>\n";
122 echo '<td colspan="3">';
123 print_bracket_link( 'search.php?tag_string='.urlencode("+$t_tag_row[name]".config_get('tag_separator')."+$t_name"), sprintf( lang_get( 'tag_related_issues' ), $t_tag['count'] ) );
124 echo '</td></tr>';
126 $i++;
131 <!-- Buttons -->
132 <tr>
133 <td colspan="5">
134 <?php
135 $t_can_edit = access_has_global_level( config_get( 'tag_edit_threshold' ) );
136 $t_can_edit_own = $t_can_edit || auth_get_current_user_id() == tag_get_field( $f_tag_id, 'user_id' )
137 && access_has_global_level( config_get( 'tag_edit_own_threshold' ) );
139 if ( $t_can_edit_own ) { ?>
140 <form action="tag_update_page.php" method="post">
141 <?php # CSRF protection not required here - form does not result in modifications ?>
142 <input type="hidden" name="tag_id" value="<?php echo $f_tag_id ?>" />
143 <input type="submit" class="button" value="<?php echo lang_get( 'tag_update_button' ) ?>" />
144 </form>
145 <?php } if ( $t_can_edit ) { ?>
146 <form action="tag_delete.php" method="post">
147 <?php echo form_security_field( 'tag_delete' ) ?>
148 <input type="hidden" name="tag_id" value="<?php echo $f_tag_id ?>" />
149 <input type="submit" class="button" value="<?php echo lang_get( 'tag_delete_button' ) ?>" />
150 </form>
151 <?php } ?>
153 </td>
154 </tr>
156 </table>
157 <?php
158 html_page_bottom();