SOAP API: do not try to unserialize an invalid filter
[mantis.git] / tag_view_page.php
blobafe9d26306379b754feba04eb7906d543367e7db
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 - 2011 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 /**
39 * MantisBT Core API's
41 require_once( 'core.php' );
42 require_api( 'access_api.php' );
43 require_api( 'authentication_api.php' );
44 require_api( 'compress_api.php' );
45 require_api( 'config_api.php' );
46 require_api( 'form_api.php' );
47 require_api( 'gpc_api.php' );
48 require_api( 'helper_api.php' );
49 require_api( 'html_api.php' );
50 require_api( 'lang_api.php' );
51 require_api( 'print_api.php' );
52 require_api( 'string_api.php' );
53 require_api( 'tag_api.php' );
54 require_api( 'user_api.php' );
56 access_ensure_global_level( config_get( 'tag_view_threshold' ) );
57 compress_enable();
59 $f_tag_id = gpc_get_int( 'tag_id' );
60 $t_tag_row = tag_get( $f_tag_id );
62 $t_name = string_display_line( $t_tag_row['name'] );
63 $t_description = string_display( $t_tag_row['description'] );
64 $t_can_edit = access_has_global_level( config_get( 'tag_edit_threshold' ) );
65 $t_can_edit_own = $t_can_edit || auth_get_current_user_id() == tag_get_field( $f_tag_id, 'user_id' )
66 && access_has_global_level( config_get( 'tag_edit_own_threshold' ) );
69 html_page_top( sprintf( lang_get( 'tag_details' ), $t_name ) ); ?>
71 <div id="tag-view-div" class="form-container">
72 <h2><?php echo sprintf( lang_get( 'tag_details' ), $t_name ) ?></h2>
73 <div class="section-link">
74 <?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 ) ) ); ?>
75 </div>
76 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
77 <span class="display-label"><span><?php echo lang_get( 'tag_id' ) ?></span></span>
78 <span class="display-value"><span><?php echo $t_tag_row['id'] ?></span></span>
79 <span class="label-style"></span>
80 </div>
81 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
82 <span class="display-label"><span><?php echo lang_get( 'tag_name' ) ?></span></span>
83 <span class="display-value"><span><?php echo $t_name ?></span></span>
84 <span class="label-style"></span>
85 </div>
86 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
87 <span class="display-label"><span><?php echo lang_get( 'tag_creator' ) ?></span></span>
88 <span class="display-value"><span><?php echo string_display_line( user_get_name($t_tag_row['user_id']) ) ?></span></span>
89 <span class="label-style"></span>
90 </div>
91 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
92 <span class="display-label"><span><?php echo lang_get( 'tag_created' ) ?></span></span>
93 <span class="display-value"><span><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_created'] ) ?></span></span>
94 <span class="label-style"></span>
95 </div>
96 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
97 <span class="display-label"><span><?php echo lang_get( 'tag_updated' ) ?></span></span>
98 <span class="display-value"><span><?php echo date( config_get( 'normal_date_format' ), $t_tag_row['date_updated'] ) ?></span></span>
99 <span class="label-style"></span>
100 </div>
101 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
102 <span class="display-label"><span><?php echo lang_get( 'tag_description' ) ?></span></span>
103 <span class="display-value"><span><?php echo $t_description ?></span></span>
104 <span class="label-style"></span>
105 </div><?php
106 $t_tags_related = tag_stats_related( $f_tag_id );
107 if ( count( $t_tags_related ) ) { ?>
108 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
109 <span class="display-label"><span><?php echo lang_get( 'tag_related' ); ?></span></span>
110 <div class="display-value"><div>
111 <table id="related-tags" class="tag-list" cellpadding="5" cellspacing="1" border="1"><?php
112 foreach( $t_tags_related as $t_tag ) {
113 $t_name = string_display_line( $t_tag['name'] );
114 $t_description = string_display_line( $t_tag['description'] );
115 $t_count = $t_tag['count'];
116 $t_link = string_html_specialchars( 'search.php?tag_string='.urlencode("+$t_tag_row[name]".config_get('tag_separator')."+$t_name") );
117 $t_label = sprintf( lang_get( 'tag_related_issues' ), $t_tag['count'] ); ?>
118 <tr>
119 <td><span class="tag-link"><a href="tag_view_page.php?tag_id=<?php echo $t_tag[id]; ?>" title="<?php echo $t_description; ?>"><?php echo $t_name; ?></a></span></td>
120 <td><span class="tag-filter"><a href="<?php echo $t_link; ?>"><?php echo $t_label; ?></a></span></td>
121 </tr><?php
122 } ?>
123 </table><?php
124 } ?></div></div>
125 <span class="label-style"></span>
126 </div><?php
127 if ( $t_can_edit_own || $t_can_edit ) { ?>
128 <div class="action-buttons"><?php
129 if ( $t_can_edit_own ) { ?>
130 <form class="action-button" action="tag_update_page.php" method="post">
131 <fieldset>
132 <?php # CSRF protection not required here - form does not result in modifications ?>
133 <input type="hidden" name="tag_id" value="<?php echo $f_tag_id ?>" />
134 <input type="submit" class="button" value="<?php echo lang_get( 'tag_update_button' ) ?>" />
135 </fieldset>
136 </form><?php
139 if ( $t_can_edit ) { ?>
140 <form action="tag_delete.php" method="post" class="action-button">
141 <fieldset>
142 <?php echo form_security_field( 'tag_delete' ) ?>
143 <input type="hidden" name="tag_id" value="<?php echo $f_tag_id ?>" />
144 <input type="submit" class="button" value="<?php echo lang_get( 'tag_delete_button' ) ?>" />
145 </fieldset>
146 </form><?php
147 } ?>
148 </div><?php
149 } ?>
150 </div><?php
152 html_page_bottom();