Skip to content
Newer
Older
100644 256 lines (216 sloc) 8.94 KB
faecea3 @jreese Created dynamic event system.
jreese authored
1 <?php
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
2 # MantisBT - a php based bugtracking system
faecea3 @jreese Created dynamic event system.
jreese authored
3
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
4 # MantisBT is free software: you can redistribute it and/or modify
faecea3 @jreese Created dynamic event system.
jreese authored
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.
8 #
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
9 # MantisBT is distributed in the hope that it will be useful,
faecea3 @jreese Created dynamic event system.
jreese authored
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.
13 #
14 # You should have received a copy of the GNU General Public License
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
faecea3 @jreese Created dynamic event system.
jreese authored
16
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
17 /**
18 * @package MantisBT
c757c81 @dregad Update copyright year to 2012
dregad authored
19 * @copyright Copyright (C) 2002 - 2012 MantisBT Team - mantisbt-dev@lists.sourceforge.net
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
20 * @link http://www.mantisbt.org
21 */
22 /**
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
23 * MantisBT Core API's
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
24 */
25 require_once( 'core.php' );
faecea3 @jreese Created dynamic event system.
jreese authored
26
27 auth_reauthenticate();
28 access_ensure_global_level( config_get( 'manage_plugin_threshold' ) );
29
230e3f4 @grangeway HTML api documentation + tidy up of api names
grangeway authored
30 html_page_top( lang_get( 'manage_plugin_link' ) );
faecea3 @jreese Created dynamic event system.
jreese authored
31
32 print_manage_menu( 'manage_plugin_page.php' );
33
63f7234 @jreese Added plugin sorting on management page by name.
jreese authored
34 function plugin_sort( $p1, $p2 ) {
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
35 return strcasecmp( $p1->name, $p2->name );
63f7234 @jreese Added plugin sorting on management page by name.
jreese authored
36 }
37
faecea3 @jreese Created dynamic event system.
jreese authored
38 $t_plugins = plugin_find_all();
63f7234 @jreese Added plugin sorting on management page by name.
jreese authored
39 uasort( $t_plugins, 'plugin_sort' );
40
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
41 global $g_plugin_cache;
faecea3 @jreese Created dynamic event system.
jreese authored
42
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
43 $t_plugins_installed = array();
faecea3 @jreese Created dynamic event system.
jreese authored
44 $t_plugins_available = array();
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
45
46 foreach( $t_plugins as $t_basename => $t_plugin ) {
47 if ( isset( $g_plugin_cache[$t_basename] ) ) {
48 $t_plugins_installed[$t_basename] = $t_plugin;
49 } else {
50 $t_plugins_available[$t_basename] = $t_plugin;
faecea3 @jreese Created dynamic event system.
jreese authored
51 }
52 }
53
fbae2c2 @grangeway Empty ?> <?php block can be removed.
grangeway authored
54 if ( 0 < count( $t_plugins_installed ) ) {
faecea3 @jreese Created dynamic event system.
jreese authored
55 ?>
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
56 <br />
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
57 <form action="manage_plugin_update.php" method="post">
58 <?php echo form_security_field( 'manage_plugin_update' ) ?>
faecea3 @jreese Created dynamic event system.
jreese authored
59 <table class="width100" cellspacing="1">
60
61 <!-- Title -->
62 <tr>
63 <td class="form-title" colspan="7">
64 <?php echo lang_get( 'plugins_installed' ) ?>
65
66 </td>
67 </tr>
68
69 <!-- Info -->
70 <tr class="row-category">
71 <td width="20%"><?php echo lang_get( 'plugin' ) ?></td>
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
72 <td width="35%"><?php echo lang_get( 'plugin_description' ) ?></td>
73 <td width="20%"><?php echo lang_get( 'plugin_depends' ) ?></td>
0fb8735 @jreese Added priority and protected properties to installed plugins.
jreese authored
74 <td width="7%"><?php echo lang_get( 'plugin_priority' ) ?></td>
75 <td width="8%"><?php echo lang_get( 'plugin_protected' ) ?></td>
faecea3 @jreese Created dynamic event system.
jreese authored
76 <td width="10%"><?php echo lang_get( 'plugin_actions' ) ?></td>
77 </tr>
78
5cf7970 @grangeway Consistency update
grangeway authored
79 <?php
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
80 foreach ( $t_plugins_installed as $t_basename => $t_plugin ) {
81 $t_description = string_display_line_links( $t_plugin->description );
82 $t_author = $t_plugin->author;
83 $t_contact = $t_plugin->contact;
84 $t_page = $t_plugin->page;
85 $t_url = $t_plugin->url;
86 $t_requires = $t_plugin->requires;
faecea3 @jreese Created dynamic event system.
jreese authored
87 $t_depends = array();
0fb8735 @jreese Added priority and protected properties to installed plugins.
jreese authored
88 $t_priority = plugin_priority( $t_basename );
89 $t_protected = plugin_protected( $t_basename );
faecea3 @jreese Created dynamic event system.
jreese authored
90
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
91 $t_name = string_display_line( $t_plugin->name.' '.$t_plugin->version );
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
92 if ( !is_blank( $t_page ) ) {
3f4b4dd @jreese Update plugin API and management pages to work with new header redire…
jreese authored
93 $t_name = '<a href="' . string_attribute( plugin_page( $t_page, false, $t_basename ) ) . '">' . $t_name . '</a>';
faecea3 @jreese Created dynamic event system.
jreese authored
94 }
95
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
96 if ( !is_blank( $t_author ) ) {
faecea3 @jreese Created dynamic event system.
jreese authored
97 if ( is_array( $t_author ) ) {
98 $t_author = implode( $t_author, ', ' );
99 }
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
100 if ( !is_blank( $t_contact ) ) {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
101 $t_author = '<br />' . sprintf( lang_get( 'plugin_author' ),
281de65 @jreese Switch to using string_display_line for performance.
jreese authored
102 '<a href="mailto:' . string_attribute( $t_contact ) . '">' . string_display_line( $t_author ) . '</a>' );
faecea3 @jreese Created dynamic event system.
jreese authored
103 } else {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
104 $t_author = '<br />' . string_display_line( sprintf( lang_get( 'plugin_author' ), $t_author ) );
faecea3 @jreese Created dynamic event system.
jreese authored
105 }
106 }
107
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
108 if ( !is_blank( $t_url ) ) {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
109 $t_url = '<br />' . lang_get( 'plugin_url' ) . lang_get( 'word_separator' ) . "<a href=\"$t_url\">$t_url</a>";
faecea3 @jreese Created dynamic event system.
jreese authored
110 }
111
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
112 $t_upgrade = plugin_needs_upgrade( $t_plugin );
113 $t_uninstall = ( 'MantisCore' != $t_basename && !$t_protected );
5b46580 @jreese Change plugin API to allow plugins to check if they need upgrades.
jreese authored
114
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
115 if ( is_array( $t_requires ) ) {
116 foreach( $t_requires as $t_plugin => $t_version ) {
117 $t_dependency = plugin_dependency( $t_plugin, $t_version );
118 if ( 1 == $t_dependency ) {
119 if ( is_blank( $t_upgrade ) ) {
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
120 $t_depends[] = '<span class="small dependency_met">'.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).'</span>';
faecea3 @jreese Created dynamic event system.
jreese authored
121 } else {
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
122 $t_depends[] = '<span class="small dependency_upgrade">'.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).'</span>';
faecea3 @jreese Created dynamic event system.
jreese authored
123 }
9aacdc6 @grangeway elseif -> else if
grangeway authored
124 } else if ( -1 == $t_dependency ) {
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
125 $t_depends[] = '<span class="small dependency_dated">'.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).'</span>';
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
126 } else {
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
127 $t_depends[] = '<span class="small dependency_unmet">'.string_display_line( $t_plugin.' '.$t_version ).'</span>';
faecea3 @jreese Created dynamic event system.
jreese authored
128 }
129 }
130 }
131
132 if ( 0 < count( $t_depends ) ) {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
133 $t_depends = implode( $t_depends, '<br />' );
faecea3 @jreese Created dynamic event system.
jreese authored
134 } else {
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
135 $t_depends = '<span class="small dependency_met">' . lang_get( 'plugin_no_depends' ) . '</span>';
faecea3 @jreese Created dynamic event system.
jreese authored
136 }
137
138 echo '<tr ',helper_alternate_class(),'>';
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
139 echo '<td class="small center">',$t_name,'<input type="hidden" name="change_',$t_basename,'" value="1"/></td>';
140 echo '<td class="small">',$t_description,$t_author,$t_url,'</td>';
141 echo '<td class="small center">',$t_depends,'</td>';
0fb8735 @jreese Added priority and protected properties to installed plugins.
jreese authored
142 if ( 'MantisCore' != $t_basename ) {
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
143 echo '<td class="center">','<select name="priority_',$t_basename,'">',print_plugin_priority_list( $t_priority ),'</select>','</td>';
144 echo '<td class="center">','<input type="checkbox" name="protected_',$t_basename,'" '.( $t_protected ? 'checked="checked" ' : '').'/>','</td>';
0fb8735 @jreese Added priority and protected properties to installed plugins.
jreese authored
145 } else {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
146 echo '<td>&#160;</td><td>&#160;</td>';
0fb8735 @jreese Added priority and protected properties to installed plugins.
jreese authored
147 }
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
148 echo '<td class="center">';
4c60b43 @davidhicks Add CSRF protection for manage_plugin_upgrade
davidhicks authored
149 if ( $t_upgrade ) { print_bracket_link( 'manage_plugin_upgrade.php?name=' . $t_basename . form_security_param( 'manage_plugin_upgrade' ), lang_get( 'plugin_upgrade' ) ); }
e336d85 @davidhicks Add CSRF protection for manage_plugin_uninstall
davidhicks authored
150 if ( $t_uninstall ) { print_bracket_link( 'manage_plugin_uninstall.php?name=' . $t_basename . form_security_param( 'manage_plugin_uninstall' ), lang_get( 'plugin_uninstall' ) ); }
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
151 echo '</td></tr>';
faecea3 @jreese Created dynamic event system.
jreese authored
152 } ?>
153
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
154 <tr>
155 <td colspan="3"></td>
156 <td colspan="2" class="center"><input type="submit" value="<?php echo lang_get( 'plugin_update' ) ?>"/></td>
157 <td></td>
158 </tr>
159
faecea3 @jreese Created dynamic event system.
jreese authored
160 </table>
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
161 </form>
fbae2c2 @grangeway Empty ?> <?php block can be removed.
grangeway authored
162 <?php
163 }
faecea3 @jreese Created dynamic event system.
jreese authored
164
fbae2c2 @grangeway Empty ?> <?php block can be removed.
grangeway authored
165 if ( 0 < count( $t_plugins_available ) ) {
166 ?>
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
167 <br />
faecea3 @jreese Created dynamic event system.
jreese authored
168 <table class="width100" cellspacing="1">
169
170 <!-- Title -->
171 <tr>
172 <td class="form-title" colspan="7">
173 <?php echo lang_get( 'plugins_available' ) ?>
174
175 </td>
176 </tr>
177
178 <!-- Info -->
179 <tr class="row-category">
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
180 <td width="25%"><?php echo lang_get( 'plugin' ) ?></td>
181 <td width="45%"><?php echo lang_get( 'plugin_description' ) ?></td>
faecea3 @jreese Created dynamic event system.
jreese authored
182 <td width="20%"><?php echo lang_get( 'plugin_depends' ) ?></td>
183 <td width="10%"><?php echo lang_get( 'plugin_actions' ) ?></td>
184 </tr>
185
5cf7970 @grangeway Consistency update
grangeway authored
186 <?php
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
187 foreach ( $t_plugins_available as $t_basename => $t_plugin ) {
188 $t_description = string_display_line_links( $t_plugin->description );
189 $t_author = $t_plugin->author;
190 $t_contact = $t_plugin->contact;
191 $t_url = $t_plugin->url ;
192 $t_requires = $t_plugin->requires;
faecea3 @jreese Created dynamic event system.
jreese authored
193 $t_depends = array();
194
a44abfc @jreese Converted plugin system to use a class-based structure.
jreese authored
195 $t_name = string_display_line( $t_plugin->name.' '.$t_plugin->version );
faecea3 @jreese Created dynamic event system.
jreese authored
196
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
197 if ( !is_blank( $t_author ) ) {
faecea3 @jreese Created dynamic event system.
jreese authored
198 if ( is_array( $t_author ) ) {
199 $t_author = implode( $t_author, ', ' );
200 }
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
201 if ( !is_blank( $t_contact ) ) {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
202 $t_author = '<br />' . sprintf( lang_get( 'plugin_author' ),
281de65 @jreese Switch to using string_display_line for performance.
jreese authored
203 '<a href="mailto:' . string_display_line( $t_contact ) . '">' . string_display_line( $t_author ) . '</a>' );
faecea3 @jreese Created dynamic event system.
jreese authored
204 } else {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
205 $t_author = '<br />' . string_display_line( sprintf( lang_get( 'plugin_author' ), $t_author ) );
faecea3 @jreese Created dynamic event system.
jreese authored
206 }
207 }
208
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
209 if ( !is_blank( $t_url ) ) {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
210 $t_url = '<br />' . lang_get( 'plugin_url' ) . lang_get( 'word_separator' ) . "<a href=\"$t_url\">$t_url</a>";
faecea3 @jreese Created dynamic event system.
jreese authored
211 }
212
213 $t_ready = true;
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
214 if ( is_array( $t_requires ) ) {
215 foreach( $t_requires as $t_plugin => $t_version ) {
216 $t_dependency = plugin_dependency( $t_plugin, $t_version );
217 if ( 1 == $t_dependency ) {
86b8018 @grangeway HTML Validation
grangeway authored
218 $t_depends[] = '<span class="small dependency_met">'.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).'</span>';
9aacdc6 @grangeway elseif -> else if
grangeway authored
219 } else if ( -1 == $t_dependency ) {
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
220 $t_ready = false;
86b8018 @grangeway HTML Validation
grangeway authored
221 $t_depends[] = '<span class="small dependency_dated">'.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).'</span>';
89aa245 @jreese Fix display errors and optimize plugin management page to account for…
jreese authored
222 } else {
223 $t_ready = false;
86b8018 @grangeway HTML Validation
grangeway authored
224 $t_depends[] = '<span class="small dependency_unmet">'.string_display_line( $t_plugin.' '.$t_version ).'</span>';
faecea3 @jreese Created dynamic event system.
jreese authored
225 }
226 }
227 }
228
229 if ( 0 < count( $t_depends ) ) {
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
230 $t_depends = implode( $t_depends, '<br />' );
faecea3 @jreese Created dynamic event system.
jreese authored
231 } else {
86b8018 @grangeway HTML Validation
grangeway authored
232 $t_depends = '<span class="small dependency_met">' . lang_get( 'plugin_no_depends' ) . '</span>';
faecea3 @jreese Created dynamic event system.
jreese authored
233 }
234
235 echo '<tr ',helper_alternate_class(),'>';
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
236 echo '<td class="small center">',$t_name,'</td>';
237 echo '<td class="small">',$t_description,$t_author,$t_url,'</td>';
faecea3 @jreese Created dynamic event system.
jreese authored
238 echo '<td class="center">',$t_depends,'</td>';
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
239 echo '<td class="center">';
bc5d926 @davidhicks Add CSRF protection for manage_plugin_install
davidhicks authored
240 if ( $t_ready ) { print_bracket_link( 'manage_plugin_install.php?name=' . $t_basename . form_security_param( 'manage_plugin_install' ), lang_get( 'plugin_install' ) ); }
3ab5a4f @jreese Greatly improved usability and readability of plugin management.
jreese authored
241 echo '</td></tr>';
faecea3 @jreese Created dynamic event system.
jreese authored
242 } ?>
243
244 </table>
245 <?php } ?>
246
a256ece @siebrand * Replace &nbsp; with HTML5 compliant &#160;
siebrand authored
247 <br /><?php echo lang_get( 'plugin_key' ) ?>:
ae9c59a @jreese Fix for checking in the wrong patch.
jreese authored
248 <span class='dependency_met'><?php echo lang_get( 'plugin_key_met' ) ?></span>,
249 <span class='dependency_unmet'><?php echo lang_get( 'plugin_key_unmet' ) ?></span>,
250 <span class='dependency_dated'><?php echo lang_get( 'plugin_key_dated' ) ?></span>,
251 <span class='dependency_upgrade'><?php echo lang_get( 'plugin_key_upgrade' ) ?></span>.
5b46580 @jreese Change plugin API to allow plugins to check if they need upgrades.
jreese authored
252
faecea3 @jreese Created dynamic event system.
jreese authored
253 <?php
230e3f4 @grangeway HTML api documentation + tidy up of api names
grangeway authored
254 html_page_bottom();
faecea3 @jreese Created dynamic event system.
jreese authored
255
Something went wrong with that request. Please try again.