getPlugins(false); $plugins_list = $plugins->getPluginsList(); $is_writable = is_writable($plugins_root); # Installation d'un thème if ($is_writable && !empty($_POST['new_tool'])) { $tool_url = strip_tags($_POST['new_tool']); $parsed_url = parse_url($tool_url); if (empty($parsed_url['scheme']) || !preg_match('/^http|ftp$/',$parsed_url['scheme']) || empty($parsed_url['host']) || empty($parsed_url['path'])) { $err = __('URL is not valid.'); } else { if (($err = $plugins->install($tool_url)) === true) { header('Location: tools.php?p=toolsmng'); exit; } } } # Operations sur les plugins if ($is_writable && !empty($_POST['tools_action']) && is_array($_POST['tool_ids'])) { $action = $_POST['tools_action']; $ids = $_POST['tool_ids']; # Changement de status des plugins if ($action == 'switch') { foreach ($ids as $tool_id) { if (in_array($tool_id,array_keys($plugins_list)) && $tool_id != 'toolsmng') { $plugins->switchStatus($tool_id); } } header('Location: tools.php?p=toolsmng'); exit; } elseif ($action == 'delete') { foreach ($ids as $tool_id) { if (in_array($tool_id,array_keys($plugins_list)) && $tool_id != 'toolsmng') { @files::deltree($plugins_root.'/'.$tool_id); } } header('Location: tools.php?p=toolsmng'); exit; } } if($err != '') { buffer::str( '

'.__('Error(s)').' :

'.$err.'
' ); } buffer::str( '

'.__('Plugins manager').'

'. '

'.__('Install a plugin').'

' ); if (!$is_writable) { buffer::str( '

'.sprintf(__('The folder %s is not writable, please check its permissions.'), DC_ECRIRE.'/tools/').'

' ); } else { buffer::str( '
'. '

'. form::field('new_tool',50,'',htmlspecialchars($new_tool)).'

'. '

'. dcNonce::form(). ''. '

'. '
' ); } buffer::str( '

'.__('Install new plugins').'

' ); $tools_actions = array( ' ' => '', __('delete') => 'delete', __('switch status') => 'switch' ); # Traduction des plugins foreach ($plugins_list as $k => $v) { $plugins->loadl10n($k); $plugins_list[$k]['label'] = __($v['label']); $plugins_list[$k]['desc'] = __($v['desc']); } # Tri des plugins par leur nom uasort($plugins_list,create_function('$a,$b','return strcmp($a["label"],$b["label"]);')); buffer::str( '

'.__('List of installed plugins').'

'. '
' ); foreach ($plugins_list as $k => $v) { $p_style_bg = ''; if (file_exists($plugins_root.$k.'/icon.png')) { $p_style_bg = 'background: url(tools/'.$k.'/icon.png) center left no-repeat;'; } $p_style = ' style="padding-left:40px;'.$p_style_bg.'"'; $chk_enabled = false; if ($k != 'toolsmng') { $chk_enabled = (is_writable($plugins_root.$k.'/desc.xml') || $is_writable); } if ($v['active']) { $tool_status_img = ' '; $tool_status_style = ''; $tool_link = ''.__($v['label']).''; } else { $tool_status_img = ' '; $tool_status_style = ' cancel'; $tool_link = ''.__($v['label']).''; } buffer::str( "\n".'
'. '

'. $tool_status_img. form::checkbox('tool_ids[]',$k,'','','',!$chk_enabled). $tool_link.' - ('.$k.')

'. ''.__($v['desc']).'
'. 'par '.$v['author'].' - '.__('version').' '.$v['version'].'

' ); } buffer::str( '
'. '

'. '

'. dcNonce::form(). ' '. '

' ); // This panel's JS $PLUGIN_HEAD = ''; ?>