[ Index ] |
|
Code source de Plume CMS 1.2.2 |
1 <?php 2 /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 3 /* 4 # ***** BEGIN LICENSE BLOCK ***** 5 # This file is part of Plume CMS, a website management application. 6 # Copyright (C) 2001-2005 Loic d'Anterroches and contributors. 7 # 8 # Plume CMS is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # Plume CMS is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 # 22 # ***** END LICENSE BLOCK ***** */ 23 24 require_once 'path.php'; 25 require_once $_PX_config['manager_path'].'/prepend.php'; 26 27 auth::checkAuth(PX_AUTH_NORMAL); 28 $m = new Manager(); 29 $_px_theme = $m->user->getTheme(); 30 31 /* ================================================== * 32 * Process block * 33 * ================================================== */ 34 35 $px_password = ''; 36 $px_realname = $m->user->f('user_realname'); 37 $px_email = $m->user->f('user_email'); 38 $px_pubemail = $m->user->f('user_pubemail'); 39 $px_lang = $m->user->getPref('lang'); 40 41 // get the available languages 42 $localedir = dirname(__FILE__).'/locale/'; 43 $arry_lang = array(); 44 $arry_codes = l10n::getIsoCodes(); 45 $west_codes = l10n::getIsoWestern(); 46 $D = dir($localedir); 47 while(false !== ($entry = $D->read())) { 48 if (is_dir($localedir.$entry) && preg_match('/^[a-z]{2}$/', $entry)) { 49 if ('utf-8' == strtolower($_PX_config['encoding']) or in_array($entry, $west_codes)) { 50 $label = $arry_codes[$entry]; 51 $arry_lang[$label] = $entry; 52 } 53 } 54 } 55 unset($arry_codes, $west_codes); //big arrays not needed anymore 56 $D->close(); 57 $arry_lang['English'] = 'en'; 58 59 60 // get the available themes 61 require dirname(__FILE__).'/extinc/class.plugins.php'; 62 $themes_root = dirname(__FILE__).'/themes/'; 63 64 $objPlugins = new plugins($themes_root); 65 $themes_list = $objPlugins->getPlugins('theme'); 66 67 68 /*================================================= 69 Save/Add the user 70 =================================================*/ 71 if (!empty($_POST['save'])) { 72 // Save the prefs 73 $px_id = $m->user->f('user_id'); 74 $px_username = $m->user->f('user_username'); 75 $px_password = trim($_POST['u_password']); 76 $px_realname = trim($_POST['u_realname']); 77 $px_email = trim($_POST['u_email']); 78 $px_pubemail = trim($_POST['u_pubemail']); 79 80 $ok = $m->user->savePref('lang', trim($_POST['u_lang']), '#all#'); 81 if ($ok !== true) { 82 $m->setError($ok, 500); 83 } 84 if (($ok === true) && false !== ($id = $m->saveUser($px_id, $px_username, $px_password, $px_realname, $px_email, $px_pubemail))) { 85 $m->setMessage(__('Preferences successfully saved.')); 86 header('Location: prefs.php'); 87 exit; 88 } 89 } 90 91 if (!empty($_GET['switchtheme'])) { 92 if (!empty($themes_list[trim($_GET['switchtheme'])])) { 93 //theme exists, can be used 94 $ok = $m->user->savePref('theme', trim($_GET['switchtheme']), '#all#'); 95 if ($ok !== true) { 96 $m->setError($ok, 500); 97 } else { 98 $m->setMessage(__('Theme successfully changed.')); 99 header('Location: prefs.php'); 100 exit; 101 } 102 } 103 104 } 105 106 107 /* ============================= * 108 * Display block * 109 * ============================= */ 110 $px_title = __('Preferences'); 111 include dirname(__FILE__).'/mtemplates/_top.php'; 112 113 echo '<h1>'. __('Preferences')."</h1>\n\n"; 114 115 ?> 116 117 <form action="prefs.php" method="post" id="formPost"> 118 <p class="field"><label class="float" for="u_realname" style="display:inline"><strong><?php echo __('Name:'); ?></strong></label> 119 <?php echo form::textField('u_realname', 30, 50, $px_realname, '', ''); ?> 120 </p> 121 122 <p class="field"><label class="float" for="u_email" style="display:inline"><strong><?php echo __('Email <span class="small">(not shown)</span>:'); ?></strong></label> 123 <?php echo form::textField('u_email', 30, 50, $px_email, '', ''); ?> 124 </p> 125 126 <p class="field"><label class="float" for="u_pubemail" style="display:inline"><?php echo __('Public email:'); ?></label> 127 <?php echo form::textField('u_pubemail', 30, 50, $px_pubemail, '', ''); ?> 128 </p> 129 130 <p class="field"><label class="float" for="u_password" style="display:inline"><?php echo __('Password:'); ?></label> 131 <?php echo form::textField('u_password', 30, 50, '', '', ''); ?> 132 <br /><?php echo __('(keep empty not to change it)'); ?></p> 133 134 <p class="field"><label class="float" for="u_lang" style="display:inline"><?php echo __('Interface language:'); ?></label> 135 <?php echo form::combobox('u_lang', $arry_lang, $px_lang); ?></p> 136 137 <?php if (false && count($m->user->webs)): ?> 138 <p class="field"><label class="float" for="u_default" style="display:inline"><?php echo __('Default website to edit:'); ?></label> 139 <?php 140 reset($m->user->webs); 141 $arry_websites = array(); 142 foreach ($m->user->webs as $site => $score) { 143 $arry_websites[$m->user->wdata[$site]['website_name']] = $site; 144 } 145 echo form::combobox('u_default', $arry_websites, $px_default); 146 ?><br /> 147 <span class="small"><?php echo __('If saved in a cookie, the last edited website is proposed after login.'); ?></span> 148 </p> 149 <?php endif; ?> 150 151 <p> <input name="save" type="submit" class="submit" value="<?php echo __('Save [s]'); ?>" 152 accesskey="s" /> 153 </p> 154 </form> 155 <?php 156 if (count($themes_list) > 1): 157 ?> 158 <hr class="soft" /> 159 <h2><?php echo __('Manager Themes'); ?></h2> 160 161 <dl class="themes-list"> 162 <?php 163 reset($themes_list); 164 foreach($themes_list as $theme) { 165 echo '<dt><img alt="" src="themes/'.$theme['name'].'/preview.png"> <strong>'.$theme['label'].'</strong> '.__('by').' '.$theme['author'].'</dt>'."\n"; 166 echo '<dd>'.$theme['desc'].' - '.__('version:').' '.$theme['version']; 167 if ($_px_theme != $theme['name']) { 168 echo '<br /><a href="prefs.php?switchtheme='.$theme['name'].'"><strong>'.__('Use this theme').'</strong></a>'; 169 } 170 echo '</dd>'."\n\n"; 171 } 172 echo '</dl>'."\n"; 173 endif; 174 175 /*================================================= 176 Load common bottom page 177 =================================================*/ 178 include dirname(__FILE__).'/mtemplates/_bottom.php'; 179 180 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |