| 1 |
238
|
stefan
|
<?php
|
| 2 |
|
|
|
| 3 |
399
|
Ruebenwurz
|
// $Id$
|
| 4 |
|
|
|
| 5 |
238
|
stefan
|
/*
|
| 6 |
|
|
|
| 7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
| 8 |
915
|
Ruebenwurz
|
Copyright (C) 2004-2009, Ryan Djurovich
|
| 9 |
238
|
stefan
|
|
| 10 |
|
|
Website Baker is free software; you can redistribute it and/or modify
|
| 11 |
|
|
it under the terms of the GNU General Public License as published by
|
| 12 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
| 13 |
|
|
(at your option) any later version.
|
| 14 |
|
|
|
| 15 |
|
|
Website Baker is distributed in the hope that it will be useful,
|
| 16 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 17 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 18 |
|
|
GNU General Public License for more details.
|
| 19 |
|
|
|
| 20 |
|
|
You should have received a copy of the GNU General Public License
|
| 21 |
|
|
along with Website Baker; if not, write to the Free Software
|
| 22 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 23 |
|
|
|
| 24 |
|
|
*/
|
| 25 |
|
|
|
| 26 |
|
|
require('../../config.php');
|
| 27 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
| 28 |
|
|
$admin = new admin('Preferences');
|
| 29 |
|
|
|
| 30 |
718
|
thorn
|
require_once(WB_PATH.'/framework/functions-utf8.php');
|
| 31 |
|
|
|
| 32 |
238
|
stefan
|
// Create new template object for the preferences form
|
| 33 |
944
|
Ruebenwurz
|
$template = new Template(THEME_PATH.'/templates');
|
| 34 |
|
|
$template->set_file('page', 'preferences.htt');
|
| 35 |
238
|
stefan
|
$template->set_block('page', 'main_block', 'main');
|
| 36 |
|
|
|
| 37 |
|
|
// Get existing value from database
|
| 38 |
|
|
$database = new database();
|
| 39 |
|
|
$query = "SELECT display_name,email FROM ".TABLE_PREFIX."users WHERE user_id = '".$admin->get_user_id()."'";
|
| 40 |
|
|
$results = $database->query($query);
|
| 41 |
|
|
if($database->is_error()) {
|
| 42 |
|
|
$admin->print_error($database->get_error(), 'index.php');
|
| 43 |
|
|
}
|
| 44 |
|
|
$details = $results->fetchRow();
|
| 45 |
|
|
|
| 46 |
|
|
// Insert values into form
|
| 47 |
|
|
$template->set_var('DISPLAY_NAME', $details['display_name']);
|
| 48 |
|
|
$template->set_var('EMAIL', $details['email']);
|
| 49 |
|
|
|
| 50 |
|
|
// Insert language values
|
| 51 |
|
|
$template->set_block('main_block', 'language_list_block', 'language_list');
|
| 52 |
712
|
Ruebenwurz
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name");
|
| 53 |
238
|
stefan
|
if($result->numRows() > 0) {
|
| 54 |
|
|
while($addon = $result->fetchRow()) {
|
| 55 |
718
|
thorn
|
$l_codes[$addon['name']] = $addon['directory'];
|
| 56 |
|
|
$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
|
| 57 |
|
|
}
|
| 58 |
|
|
asort($l_names);
|
| 59 |
|
|
foreach($l_names as $l_name=>$v) {
|
| 60 |
238
|
stefan
|
// Insert code and name
|
| 61 |
|
|
$template->set_var(array(
|
| 62 |
718
|
thorn
|
'CODE' => $l_codes[$l_name],
|
| 63 |
1012
|
Ruebenwurz
|
'NAME' => $l_name,
|
| 64 |
|
|
'FLAG' => THEME_URL.'/images/flags/'.strtolower($l_codes[$l_name]),
|
| 65 |
238
|
stefan
|
));
|
| 66 |
|
|
// Check if it is selected
|
| 67 |
718
|
thorn
|
if(LANGUAGE == $l_codes[$l_name]) {
|
| 68 |
1012
|
Ruebenwurz
|
$template->set_var('SELECTED', ' selected="selected"');
|
| 69 |
238
|
stefan
|
} else {
|
| 70 |
|
|
$template->set_var('SELECTED', '');
|
| 71 |
|
|
}
|
| 72 |
|
|
$template->parse('language_list', 'language_list_block', true);
|
| 73 |
|
|
}
|
| 74 |
|
|
}
|
| 75 |
|
|
|
| 76 |
|
|
// Insert default timezone values
|
| 77 |
|
|
require(ADMIN_PATH.'/interface/timezones.php');
|
| 78 |
|
|
$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
|
| 79 |
|
|
foreach($TIMEZONES AS $hour_offset => $title) {
|
| 80 |
|
|
$template->set_var('VALUE', $hour_offset);
|
| 81 |
|
|
$template->set_var('NAME', $title);
|
| 82 |
|
|
if($admin->get_timezone() == $hour_offset*60*60) {
|
| 83 |
1012
|
Ruebenwurz
|
$template->set_var('SELECTED', ' selected="selected"');
|
| 84 |
238
|
stefan
|
} else {
|
| 85 |
|
|
$template->set_var('SELECTED', '');
|
| 86 |
|
|
}
|
| 87 |
|
|
$template->parse('timezone_list', 'timezone_list_block', true);
|
| 88 |
|
|
}
|
| 89 |
|
|
|
| 90 |
|
|
// Insert date format list
|
| 91 |
|
|
$user_time = true;
|
| 92 |
|
|
require(ADMIN_PATH.'/interface/date_formats.php');
|
| 93 |
|
|
$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
|
| 94 |
|
|
foreach($DATE_FORMATS AS $format => $title) {
|
| 95 |
|
|
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
|
| 96 |
|
|
if($format != 'system_default') {
|
| 97 |
|
|
$template->set_var('VALUE', $format);
|
| 98 |
|
|
} else {
|
| 99 |
|
|
$template->set_var('VALUE', '');
|
| 100 |
|
|
}
|
| 101 |
|
|
$template->set_var('NAME', $title);
|
| 102 |
|
|
if(DATE_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
|
| 103 |
1012
|
Ruebenwurz
|
$template->set_var('SELECTED', ' selected="selected"');
|
| 104 |
238
|
stefan
|
} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
|
| 105 |
1012
|
Ruebenwurz
|
$template->set_var('SELECTED', ' selected="selected"');
|
| 106 |
238
|
stefan
|
} else {
|
| 107 |
|
|
$template->set_var('SELECTED', '');
|
| 108 |
|
|
}
|
| 109 |
|
|
$template->parse('date_format_list', 'date_format_list_block', true);
|
| 110 |
|
|
}
|
| 111 |
|
|
|
| 112 |
|
|
// Insert time format list
|
| 113 |
|
|
require(ADMIN_PATH.'/interface/time_formats.php');
|
| 114 |
|
|
$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
|
| 115 |
|
|
foreach($TIME_FORMATS AS $format => $title) {
|
| 116 |
|
|
$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
|
| 117 |
|
|
if($format != 'system_default') {
|
| 118 |
|
|
$template->set_var('VALUE', $format);
|
| 119 |
|
|
} else {
|
| 120 |
|
|
$template->set_var('VALUE', '');
|
| 121 |
|
|
}
|
| 122 |
|
|
$template->set_var('NAME', $title);
|
| 123 |
|
|
if(TIME_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
|
| 124 |
1012
|
Ruebenwurz
|
$template->set_var('SELECTED', ' selected="selected"');
|
| 125 |
238
|
stefan
|
} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
|
| 126 |
|
|
$template->set_var('SELECTED', 'selected');
|
| 127 |
|
|
} else {
|
| 128 |
|
|
$template->set_var('SELECTED', '');
|
| 129 |
|
|
}
|
| 130 |
|
|
$template->parse('time_format_list', 'time_format_list_block', true);
|
| 131 |
|
|
}
|
| 132 |
|
|
|
| 133 |
|
|
// Insert language headings
|
| 134 |
|
|
$template->set_var(array(
|
| 135 |
|
|
'HEADING_MY_SETTINGS' => $HEADING['MY_SETTINGS'],
|
| 136 |
|
|
'HEADING_MY_EMAIL' => $HEADING['MY_EMAIL'],
|
| 137 |
|
|
'HEADING_MY_PASSWORD' => $HEADING['MY_PASSWORD']
|
| 138 |
|
|
)
|
| 139 |
|
|
);
|
| 140 |
|
|
// Insert language text and messages
|
| 141 |
|
|
$template->set_var(array(
|
| 142 |
|
|
'TEXT_SAVE' => $TEXT['SAVE'],
|
| 143 |
|
|
'TEXT_RESET' => $TEXT['RESET'],
|
| 144 |
|
|
'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
|
| 145 |
|
|
'TEXT_EMAIL' => $TEXT['EMAIL'],
|
| 146 |
|
|
'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
|
| 147 |
|
|
'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
|
| 148 |
|
|
'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
|
| 149 |
|
|
'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
|
| 150 |
|
|
'TEXT_CURRENT_PASSWORD' => $TEXT['CURRENT_PASSWORD'],
|
| 151 |
|
|
'TEXT_NEW_PASSWORD' => $TEXT['NEW_PASSWORD'],
|
| 152 |
|
|
'TEXT_RETYPE_NEW_PASSWORD' => $TEXT['RETYPE_NEW_PASSWORD']
|
| 153 |
|
|
)
|
| 154 |
|
|
);
|
| 155 |
|
|
|
| 156 |
|
|
// Parse template for preferences form
|
| 157 |
|
|
$template->parse('main', 'main_block', false);
|
| 158 |
|
|
$template->pparse('output', 'page');
|
| 159 |
|
|
|
| 160 |
|
|
$admin->print_footer();
|
| 161 |
|
|
|
| 162 |
239
|
stefan
|
?>
|