[ Index ] |
|
Code source de Dotclear 2.0-beta6 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2005 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 require dirname(__FILE__).'/../inc/admin/prepend.php'; 24 25 dcPage::check('admin'); 26 27 # Loading themes 28 $core->themes = new dcModules($core); 29 $core->themes->loadModules($core->blog->themes_path,null); 30 31 # Theme screenshot 32 if (!empty($_GET['shot']) && $core->themes->moduleExists($_GET['shot'])) { 33 $f = $core->blog->themes_path.'/'.$_GET['shot'].'/screenshot.jpg'; 34 if (!file_exists($f)) { 35 $f = dirname(__FILE__).'/images/noscreenshot.png'; 36 } 37 38 http::cache(array_merge(array($f),get_included_files())); 39 40 header('Content-Type: image/png'); 41 readfile($f); 42 43 exit; 44 } 45 46 # Updating theme 47 if (!empty($_POST['theme'])) 48 { 49 $core->blog->settings->setNameSpace('system'); 50 $core->blog->settings->put('theme',$_POST['theme']); 51 $core->blog->triggerBlog(); 52 http::redirect('blog_theme.php?upd=1'); 53 } 54 55 $default_tab = !empty($_REQUEST['tab']) ? html::escapeHTML($_REQUEST['tab']) : 'themes'; 56 57 dcPage::open(__('Blog themes'), 58 dcPage::jsPageTabs($default_tab) 59 ); 60 61 echo 62 '<h2>'.html::escapeHTML($core->blog->name).' > '.__('Theme settings').'</h2>'; 63 64 if (!empty($_GET['upd'])) { 65 echo '<p class="message">'.__('Theme has been successfully changed.').'</p>'; 66 } 67 68 echo 69 '<div class="multi-part" id="themes" title="'.__('Themes').'">'. 70 '<form action="blog_theme.php" method="post">'; 71 72 foreach ($core->themes->getModules() as $k => $v) 73 { 74 $screenshot = 'images/noscreenshot.png'; 75 if (file_exists($core->blog->themes_path.'/'.$k.'/screenshot.jpg')) { 76 $screenshot = 'blog_theme.php?shot='.rawurlencode($k); 77 } 78 79 $radio_id = 'theme_'.html::escapeHTML($k); 80 echo 81 '<div class="screenshot"><h3>'. 82 form::radio(array('theme',$radio_id),html::escapeHTML($k),$core->blog->settings->theme == $k).' '. 83 '<label class="classic" for="'.$radio_id.'">'. 84 html::escapeHTML($v['name']).'</label></h3>'. 85 '<p><label class="classic" for="'.$radio_id.'">'. 86 '<img src="'.$screenshot.'" width="240" height="210" alt="" /></label>'. 87 ' <br />'.sprintf(__('by %s'),html::escapeHTML($v['author'])).'</p>'. 88 '</div>'; 89 } 90 91 echo 92 '<p class="clear"><input type="submit" accesskey="s" value="'.__('save').'" /></p>'. 93 '</form>'. 94 '</div>'; 95 96 # Get current theme configuration part 97 $theme_config_file = path::real($core->blog->themes_path.'/'.$core->blog->settings->theme).'/_config.php'; 98 if (file_exists($theme_config_file)) 99 { 100 echo '<div class="multi-part" id="theme_config" title="'.__('Theme configuration').'">'; 101 102 try 103 { 104 echo '<form action="blog_theme.php" method="post">'; 105 106 include $theme_config_file; 107 108 echo 109 '<p class="clear"><input type="submit" value="'.__('save').'" />'. 110 form::hidden('tab','theme_config').'</p>'. 111 '</form>'; 112 } 113 catch (Exception $e) 114 { 115 echo '<div class="error"><p>'.$e->getMessage().'</p></div>'; 116 } 117 118 echo '</div>'; 119 } 120 121 dcPage::close(); 122 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 22:16:06 2007 | par Balluche grâce à PHPXref 0.7 |