Dotclear

source: admin/plugins.php @ 2237:911f18a5b287

Revision 2237:911f18a5b287, 6.8 KB checked in by Anne Kozlika <kozlika@…>, 12 years ago (diff)

Essentiellement des changements d'images

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::check('admin');
16
17# -- "First time" settings setup --
18if ($core->blog->settings->system->plugins_allow_multi_install === null) {
19     $core->blog->settings->system->put(
20          'plugins_allow_multi_install', false, 'boolean', 'Allow multi-installation for plugins', true, true
21     );
22}
23if ($core->blog->settings->system->store_plugin_url === null) {
24     $core->blog->settings->system->put(
25          'store_plugin_url', 'http://update.dotaddict.org/dc2/plugins.xml', 'string', 'Plugins XML feed location', true, true
26     );
27}
28
29# -- Page helper --
30$list = new adminModulesList(
31     $core->plugins, 
32     DC_PLUGINS_ROOT, 
33     $core->blog->settings->system->store_plugin_url
34);
35
36$list::$allow_multi_install = $core->blog->settings->system->plugins_allow_multi_install;
37$list::$distributed_modules = array(
38     'aboutConfig',
39     'akismet',
40     'antispam',
41     'attachments',
42     'blogroll',
43     'blowupConfig',
44     'daInstaller',
45     'fairTrackbacks',
46     'importExport',
47     'maintenance',
48     'pages',
49     'pings',
50     'simpleMenu',
51     'tags',
52     'themeEditor',
53     'userPref',
54     'widgets'
55);
56
57# -- Display module configuration page --
58if ($list->setConfiguration()) {
59
60     # Get content before page headers
61     include $list->includeConfiguration();
62
63     # Gather content
64     $list->getConfiguration();
65
66     # Display page
67     dcPage::open(__('Plugins management'),
68
69          # --BEHAVIOR-- pluginsToolsHeaders
70          $core->callBehavior('pluginsToolsHeaders', $core, true),
71
72          dcPage::breadcrumb(
73               array(
74                    html::escapeHTML($core->blog->name) => '',
75                    __('Plugins management') => $list->getURL('',false),
76                    '<span class="page-title">'.__('Plugin configuration').'</span>' => ''
77               ))
78     );
79
80     # Display previously gathered content
81     $list->displayConfiguration();
82
83     dcPage::close();
84
85     # Stop reading code here
86     return;
87}
88
89# -- Execute actions --
90try {
91     $list->doActions('plugins');
92}
93catch (Exception $e) {
94     $core->error->add($e->getMessage());
95}
96
97# -- Plugin install --
98$plugins_install = null;
99if (!$core->error->flag()) {
100     $plugins_install = $core->plugins->installModules();
101}
102
103# -- Page header --
104dcPage::open(__('Plugins management'),
105     dcPage::jsLoad('js/_plugins.js').
106     dcPage::jsPageTabs().
107
108     # --BEHAVIOR-- pluginsToolsHeaders
109     $core->callBehavior('pluginsToolsHeaders', $core, false),
110
111     dcPage::breadcrumb(
112          array(
113               __('System') => '',
114               __('Plugins management') => ''
115          ))
116);
117
118# -- Plugins install messages --
119if (!empty($plugins_install['success'])) {
120     echo 
121     '<div class="static-msg">'.__('Following plugins have been installed:').'<ul>';
122
123     foreach ($plugins_install['success'] as $k => $v) {
124          echo 
125          '<li>'.$k.'</li>';
126     }
127
128     echo 
129     '</ul></div>';
130}
131if (!empty($plugins_install['failure'])) {
132     echo 
133     '<div class="error">'.__('Following plugins have not been installed:').'<ul>';
134
135     foreach ($plugins_install['failure'] as $k => $v) {
136          echo 
137          '<li>'.$k.' ('.$v.')</li>';
138     }
139
140     echo 
141     '</ul></div>';
142}
143
144# -- Display modules lists --
145if ($core->auth->isSuperAdmin() && $list->isWritablePath()) {
146
147     # Updated modules from repo
148     $modules = $list->store->get(true);
149     if (!empty($modules)) {
150          echo 
151          '<div class="multi-part" id="update" title="'.html::escapeHTML(__('Update plugins')).'">'.
152          '<h3>'.html::escapeHTML(__('Update plugins')).'</h3>'.
153          '<p>'.sprintf(
154               __('There is one plugin to update available from repository.', 'There are %s plugins to update available from repository.', count($modules)),
155               count($modules)
156          ).'</p>';
157
158          $list
159               ->initList('plugin-update')
160               ->setTab('update')
161               ->setModules($modules)
162               ->displayModules(
163                    /*cols */      array('icon', 'name', 'version', 'current_version', 'desc'),
164                    /* actions */  array('update')
165               );
166
167          echo
168          '<p class="info vertical-separator">'.sprintf(
169               __("Visit %s repository, the resources center for Dotclear."),
170               '<a href="http://dotaddict.org/dc2/plugins">Dotaddict</a>'
171               ).
172          '</p>'.
173
174          '</div>';
175     }
176}
177
178echo
179'<div class="multi-part" id="plugins" title="'.__('Installed plugins').'">';
180
181# Activated modules
182$modules = $list->modules->getModules();
183if (!empty($modules)) {
184     
185     echo 
186     '<h3>'.($core->auth->isSuperAdmin() ?__('Activated plugins') : __('Installed plugins')).'</h3>'.
187     '<p>'.__('You can configure and manage installed plugins from this list.').'</p>';
188
189     $list
190          ->initList('plugin-activate')
191          ->setTab('plugins')
192          ->setModules($modules)
193          ->displayModules(
194               /* cols */          array('expander', 'icon', 'name', 'config', 'version', 'desc', 'distrib'),
195               /* actions */  array('deactivate', 'delete')
196          );
197}
198
199# Deactivated modules
200if ($core->auth->isSuperAdmin()) {
201     $modules = $list->modules->getDisabledModules();
202     if (!empty($modules)) {
203          echo
204          '<h3>'.__('Deactivated plugins').'</h3>'.
205          '<p>'.__('Deactivated plugins are installed but not usable. You can activate them from here.').'</p>';
206
207          $list
208               ->initList('plugin-deactivate')
209               ->setTab('plugins')
210               ->setModules($modules)
211               ->displayModules(
212                    /* cols */          array('icon', 'name', 'distrib'),
213                    /* actions */  array('activate', 'delete')
214               );
215     }
216}
217
218echo 
219'</div>';
220
221if ($core->auth->isSuperAdmin() && $list->isWritablePath()) {
222
223     # New modules from repo
224     $search = $list->getSearch();
225     $modules = $search ? $list->store->search($search) : $list->store->get();
226
227     if (!empty($search) || !empty($modules)) {
228          echo
229          '<div class="multi-part" id="new" title="'.__('Add plugins').'">'.
230          '<h3>'.__('Add plugins from repository').'</h3>'.
231          '<p>'.__('Search and install plugins directly from repository.').'</p>';
232
233          $list
234               ->initList('plugin-new')
235               ->setTab('new')
236               ->setModules($modules)
237               ->displaySearch()
238               ->displayIndex()
239               ->displayModules(
240                    /* cols */          array('expander', 'name', 'score', 'version', 'desc'),
241                    /* actions */  array('install'),
242                    /* nav limit */     true
243               );
244
245          echo
246          '<p class="info vertical-separator">'.sprintf(
247               __("Visit %s repository, the resources center for Dotclear."),
248               '<a href="http://dotaddict.org/dc2/plugins">Dotaddict</a>'
249               ).
250          '</p>'.
251
252          '</div>';
253     }
254
255     # Add a new plugin
256     echo
257     '<div class="multi-part" id="addplugin" title="'.__('Install or upgrade manually').'">'.
258     '<h3>'.__('Add plugins from a package').'</h3>'.
259     '<p>'.__('You can install plugins by uploading or downloading zip files.').'</p>';
260
261     $list->displayManualForm();
262
263     echo
264     '</div>';
265}
266
267# --BEHAVIOR-- pluginsToolsTabs
268$core->callBehavior('pluginsToolsTabs', $core);
269
270# -- Notice for super admin --
271if ($core->auth->isSuperAdmin() && !$list->isWritablePath()) {
272     echo 
273     '<p class="warning">'.__('Some functions are disabled, please give write access to your plugins directory to enable them.').'</p>';
274}
275
276dcPage::close();
Note: See TracBrowser for help on using the repository browser.

Sites map