[SPIP][PLUGINS] v3.0-->v3.2
[lhc/web/www.git] / www / ecrire / exec / info_plugin.php
1 <?php
2
3 /**
4 * Gestion d'affichage d'un descriptif de plugin en ajax
5 *
6 * @package SPIP\Core\Exec
7 */
8
9 if (!defined('_ECRIRE_INC_VERSION')) {
10 return;
11 }
12
13 include_spip('inc/actions');
14
15 /**
16 * Affichage de la description d'un plugin (en ajax)
17 *
18 * @uses plugins_get_infos_dist()
19 * @uses plugins_afficher_plugin_dist()
20 * @uses affiche_bloc_plugin()
21 * @uses ajax_retour()
22 */
23 function exec_info_plugin_dist() {
24 if (!autoriser('configurer', '_plugins')) {
25 include_spip('inc/minipres');
26 echo minipres();
27 } else {
28 $plug = _DIR_RACINE . htmlspecialchars(_request('plugin'));
29 $get_infos = charger_fonction('get_infos', 'plugins');
30 $dir = "";
31 if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) {
32 $dir = _DIR_PLUGINS;
33 } elseif (strncmp($plug, _DIR_PLUGINS_DIST, strlen(_DIR_PLUGINS_DIST)) == 0) {
34 $dir = _DIR_PLUGINS_DIST;
35 }
36 if ($dir) {
37 $plug = substr($plug, strlen($dir));
38 }
39 $info = $get_infos($plug, false, $dir);
40 $afficher_plugin = charger_fonction("afficher_plugin", "plugins");
41 ajax_retour(affiche_bloc_plugin($plug, $info, $dir));
42 }
43 }