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/>.
19 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
20 * @link http://www.mantisbt.org
23 * @uses access_api.php
24 * @uses authentication_api.php
25 * @uses config_api.php
27 * @uses helper_api.php
30 * @uses plugin_api.php
32 * @uses string_api.php
33 * @uses utility_api.php
36 require_once( 'core.php' );
37 require_api( 'access_api.php' );
38 require_api( 'authentication_api.php' );
39 require_api( 'config_api.php' );
40 require_api( 'form_api.php' );
41 require_api( 'helper_api.php' );
42 require_api( 'html_api.php' );
43 require_api( 'lang_api.php' );
44 require_api( 'plugin_api.php' );
45 require_api( 'print_api.php' );
46 require_api( 'string_api.php' );
47 require_api( 'utility_api.php' );
49 auth_reauthenticate();
50 access_ensure_global_level( config_get( 'manage_plugin_threshold' ) );
52 html_page_top( lang_get( 'manage_plugin_link' ) );
54 print_manage_menu( 'manage_plugin_page.php' );
56 function plugin_sort( $p1, $p2 ) {
57 return strcasecmp( $p1->name
, $p2->name
);
60 $t_plugins = plugin_find_all();
61 uasort( $t_plugins, 'plugin_sort' );
63 global $g_plugin_cache;
65 $t_plugins_installed = array();
66 $t_plugins_available = array();
67 $t_forced_plugins = config_get_global( 'plugins_force_installed' );
69 foreach( $t_plugins as $t_basename => $t_plugin ) {
70 if ( isset( $g_plugin_cache[$t_basename] ) ) {
71 $t_plugins_installed[$t_basename] = $t_plugin;
73 $t_plugins_available[$t_basename] = $t_plugin;
77 if ( 0 < count( $t_plugins_installed ) ) {
80 <form action
="manage_plugin_update.php" method
="post">
81 <?php
echo form_security_field( 'manage_plugin_update' ) ?
>
82 <table
class="width100" cellspacing
="1">
86 <td
class="form-title" colspan
="7">
87 <?php
echo lang_get( 'plugins_installed' ) ?
>
93 <tr
class="row-category">
94 <td width
="20%"><?php
echo lang_get( 'plugin' ) ?
></td
>
95 <td width
="35%"><?php
echo lang_get( 'plugin_description' ) ?
></td
>
96 <td width
="20%"><?php
echo lang_get( 'plugin_depends' ) ?
></td
>
97 <td width
="7%"><?php
echo lang_get( 'plugin_priority' ) ?
></td
>
98 <td width
="8%"><?php
echo lang_get( 'plugin_protected' ) ?
></td
>
99 <td width
="10%"><?php
echo lang_get( 'plugin_actions' ) ?
></td
>
103 foreach ( $t_plugins_installed as $t_basename => $t_plugin ) {
104 $t_description = string_display_line_links( $t_plugin->description
);
105 $t_author = $t_plugin->author
;
106 $t_contact = $t_plugin->contact
;
107 $t_page = $t_plugin->page
;
108 $t_url = $t_plugin->url
;
109 $t_requires = $t_plugin->requires
;
110 $t_depends = array();
111 $t_forced = isset( $t_forced_plugins[ $t_basename ] );
112 $t_priority = plugin_priority( $t_basename );
113 $t_protected = plugin_protected( $t_basename );
115 $t_name = string_display_line( $t_plugin->name
.' '.$t_plugin->version
);
116 if ( !is_blank( $t_page ) ) {
117 $t_name = '<a href="' . string_attribute( plugin_page( $t_page, false, $t_basename ) ) . '">' . $t_name . '</a>';
120 if ( !is_blank( $t_author ) ) {
121 if ( is_array( $t_author ) ) {
122 $t_author = implode( $t_author, ', ' );
124 if ( !is_blank( $t_contact ) ) {
125 $t_author = '<br/>' . sprintf( lang_get( 'plugin_author' ),
126 '<a href="mailto:' . string_attribute( $t_contact ) . '">' . string_display_line( $t_author ) . '</a>' );
128 $t_author = '<br/>' . string_display_line( sprintf( lang_get( 'plugin_author' ), $t_author ) );
132 if ( !is_blank( $t_url ) ) {
133 $t_url = '<br/>' . lang_get( 'plugin_url' ) . lang_get( 'word_separator' ) . "<a href=\"$t_url\">$t_url</a>";
136 $t_upgrade = plugin_needs_upgrade( $t_plugin );
137 $t_uninstall = ( 'MantisCore' != $t_basename && !$t_protected );
139 if ( is_array( $t_requires ) ) {
140 foreach( $t_requires as $t_plugin => $t_version ) {
141 $t_dependency = plugin_dependency( $t_plugin, $t_version );
142 if ( 1 == $t_dependency ) {
143 if ( is_blank( $t_upgrade ) ) {
144 $t_depends[] = '<span class="small dependency_met">'.string_display_line( $t_plugins[$t_plugin]->name
.' '.$t_version ).'</span>';
146 $t_depends[] = '<span class="small dependency_upgrade">'.string_display_line( $t_plugins[$t_plugin]->name
.' '.$t_version ).'</span>';
148 } else if ( -1 == $t_dependency ) {
149 $t_depends[] = '<span class="small dependency_dated">'.string_display_line( $t_plugins[$t_plugin]->name
.' '.$t_version ).'</span>';
151 $t_depends[] = '<span class="small dependency_unmet">'.string_display_line( $t_plugin.' '.$t_version ).'</span>';
156 if ( 0 < count( $t_depends ) ) {
157 $t_depends = implode( $t_depends, '<br/>' );
159 $t_depends = '<span class="small dependency_met">' . lang_get( 'plugin_no_depends' ) . '</span>';
162 echo '<tr ',helper_alternate_class(),'>';
163 echo '<td class="small center">',$t_name,'<input type="hidden" name="change_',$t_basename,'" value="1"/></td>';
164 echo '<td class="small">',$t_description,$t_author,$t_url,'</td>';
165 echo '<td class="small center">',$t_depends,'</td>';
166 if ( 'MantisCore' == $t_basename ) {
167 echo '<td> </td><td> </td>';
168 } else if ( $t_forced ) {
169 echo '<td class="center">','<select disabled="disabled">',print_plugin_priority_list( $t_priority ),'</select>','</td>';
170 echo '<td class="center">','<input type="checkbox" checked="checked" disabled="disabled"/>','</td>';
172 echo '<td class="center">','<select name="priority_',$t_basename,'">',print_plugin_priority_list( $t_priority ),'</select>','</td>';
173 echo '<td class="center">','<input type="checkbox" name="protected_',$t_basename,'" '.( $t_protected ?
'checked="checked" ' : '').'/>','</td>';
175 echo '<td class="center">';
176 if ( $t_upgrade ) { print_bracket_link( 'manage_plugin_upgrade.php?name=' . $t_basename . form_security_param( 'manage_plugin_upgrade' ), lang_get( 'plugin_upgrade' ) ); }
177 if ( $t_uninstall ) { print_bracket_link( 'manage_plugin_uninstall.php?name=' . $t_basename . form_security_param( 'manage_plugin_uninstall' ), lang_get( 'plugin_uninstall' ) ); }
182 <td colspan
="3"></td
>
183 <td colspan
="2" class="center"><input type
="submit" value
="<?php echo lang_get( 'plugin_update' ) ?>"/></td
>
192 if ( 0 < count( $t_plugins_available ) ) {
195 <table
class="width100" cellspacing
="1">
199 <td
class="form-title" colspan
="7">
200 <?php
echo lang_get( 'plugins_available' ) ?
>
206 <tr
class="row-category">
207 <td width
="25%"><?php
echo lang_get( 'plugin' ) ?
></td
>
208 <td width
="45%"><?php
echo lang_get( 'plugin_description' ) ?
></td
>
209 <td width
="20%"><?php
echo lang_get( 'plugin_depends' ) ?
></td
>
210 <td width
="10%"><?php
echo lang_get( 'plugin_actions' ) ?
></td
>
214 foreach ( $t_plugins_available as $t_basename => $t_plugin ) {
215 $t_description = string_display_line_links( $t_plugin->description
);
216 $t_author = $t_plugin->author
;
217 $t_contact = $t_plugin->contact
;
218 $t_url = $t_plugin->url
;
219 $t_requires = $t_plugin->requires
;
220 $t_depends = array();
222 $t_name = string_display_line( $t_plugin->name
.' '.$t_plugin->version
);
224 if ( !is_blank( $t_author ) ) {
225 if ( is_array( $t_author ) ) {
226 $t_author = implode( $t_author, ', ' );
228 if ( !is_blank( $t_contact ) ) {
229 $t_author = '<br/>' . sprintf( lang_get( 'plugin_author' ),
230 '<a href="mailto:' . string_display_line( $t_contact ) . '">' . string_display_line( $t_author ) . '</a>' );
232 $t_author = '<br/>' . string_display_line( sprintf( lang_get( 'plugin_author' ), $t_author ) );
236 if ( !is_blank( $t_url ) ) {
237 $t_url = '<br/>' . lang_get( 'plugin_url' ) . lang_get( 'word_separator' ) . "<a href=\"$t_url\">$t_url</a>";
241 if ( is_array( $t_requires ) ) {
242 foreach( $t_requires as $t_plugin => $t_version ) {
243 $t_dependency = plugin_dependency( $t_plugin, $t_version );
244 if ( 1 == $t_dependency ) {
245 $t_depends[] = '<span class="small dependency_met">'.string_display_line( $t_plugins[$t_plugin]->name
.' '.$t_version ).'</span>';
246 } else if ( -1 == $t_dependency ) {
248 $t_depends[] = '<span class="small dependency_dated">'.string_display_line( $t_plugins[$t_plugin]->name
.' '.$t_version ).'</span>';
251 $t_depends[] = '<span class="small dependency_unmet">'.string_display_line( $t_plugin.' '.$t_version ).'</span>';
256 if ( 0 < count( $t_depends ) ) {
257 $t_depends = implode( $t_depends, '<br/>' );
259 $t_depends = '<span class="small dependency_met">' . lang_get( 'plugin_no_depends' ) . '</span>';
262 echo '<tr ',helper_alternate_class(),'>';
263 echo '<td class="small center">',$t_name,'</td>';
264 echo '<td class="small">',$t_description,$t_author,$t_url,'</td>';
265 echo '<td class="center">',$t_depends,'</td>';
266 echo '<td class="center">';
267 if ( $t_ready ) { print_bracket_link( 'manage_plugin_install.php?name=' . $t_basename . form_security_param( 'manage_plugin_install' ), lang_get( 'plugin_install' ) ); }
274 <br
/><?php
echo lang_get( 'plugin_key_label' ) ?
>
275 <span
class='dependency_met'><?php
echo lang_get( 'plugin_key_met' ) ?
></span
>,
276 <span
class='dependency_unmet'><?php
echo lang_get( 'plugin_key_unmet' ) ?
></span
>,
277 <span
class='dependency_dated'><?php
echo lang_get( 'plugin_key_dated' ) ?
></span
>,
278 <span
class='dependency_upgrade'><?php
echo lang_get( 'plugin_key_upgrade' ) ?
></span
>.