getPlugins(false); $plugins_list = $plugins->getPluginsList(); $is_writable = is_writable($plugins_root); # Installation d'un thème if ($is_writable && !empty($_GET['tool_url'])) { $tool_url = $_GET['tool_url']; $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; } } } # Changement de status d'un plugin $switch = (!empty($_GET['switch'])) ? $_GET['switch'] : ''; if ($is_writable && $switch != '' && in_array($switch,array_keys($plugins_list)) && $switch != 'toolsmng') { $plugins->switchStatus($switch); header('Location: tools.php?p=toolsmng'); exit; } # Suppression d'un thème $delete = (!empty($_GET['delete'])) ? $_GET['delete'] : ''; if ($is_writable && $delete != '' && in_array($delete,array_keys($plugins_list)) && $delete != 'toolsmng') { files::deltree($plugins_root.'/'.$delete); 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('tool_url',50,'',$tool_url).'

'. '

'. '

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

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

' ); # 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) { buffer::str( '
'.__($v['label']).' - '.$k.'
'. '
'.__($v['desc']).'
'. 'par '.$v['author'].' - '.__('version').' '.$v['version'].'
' ); if ($k != 'toolsmng') { if (is_writable($plugins_root.$k.'/desc.xml')) { $action = $v['active'] ? 'disable' : 'enable'; buffer::str(''.__($action).''); } else { buffer::str(''.sprintf(__('cannot enable/disable'),'desc.xml').''); } if ($is_writable) { buffer::str( ' - '. __('delete').'' ); } } buffer::str('
'); } buffer::str('
'); ?>