getPlugins(false); $themes_list = $themes->getPluginsList(); $is_writable = is_writable($themes_root); $dc_ini_file = dirname(__FILE__).'/../../../conf/dotclear.ini'; $is_ini_writable = is_writable($dc_ini_file); # Installation d'un thème if ($is_writable && !empty($_POST['new_theme'])) { $new_theme = strip_tags($_POST['new_theme']); $parsed_url = parse_url($new_theme); 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 = $themes->install($new_theme)) === true) { header('Location: tools.php?p=thememng'); exit; } } } # Utilisation d'un thème if ($is_ini_writable && !empty($_POST['config'])) { $theme = strip_tags($_POST['theme']); if (in_array($theme,array_keys($themes_list))) { $objIni = new iniFile($dc_ini_file); $objIni->editVar('dc_theme',$theme); if ($objIni->saveFile() !== false) { header('Location: tools.php?p=thememng'); exit; } else { $err = __('An error occured while writing configuration file.'); } exit; } } # Suppression d'un thème elseif ($is_writable && !empty($_POST['delete']) && !empty($_POST['theme_ids'])) { $themes = $_POST['theme_ids']; foreach ($themes as $theme) { $theme = strip_tags($theme); if (in_array($theme,array_keys($themes_list)) && $theme != 'default') { files::deltree($themes_root.'/'.$theme); } } header('Location: tools.php?p=thememng'); exit; } if($err != '') { buffer::str( '

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

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

'.__('Themes manager').'

'. '

'.__('Install a theme').'

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

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

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

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

'. '

'. dcNonce::form(). '

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

'.__('Install new themes').'

' ); buffer::str( '

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

'. '
' ); foreach ($themes_list as $k => $v) { $themes->loadl10n($k); $screenshot = 'tools/thememng/noscreenshot.png'; if (file_exists($themes_root.'/'.$k.'/screenshot.jpg')) { $screenshot = dc_app_url.'/themes/'.$k.'/screenshot.jpg'; } buffer::str( "\n".'
'. '

'. ($k == dc_theme ? ''.__('Current theme').' ' : ''). ''. ''.__($v['label']).' - ('.$k.')

'. '

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

'. (($k != dc_theme && $is_writable)?'

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

'. dcNonce::form(). ''. (($is_writable)?' ':''). '

'. '
'); $PLUGIN_HEAD = ''; ?>