Changeset 2274
- Timestamp:
- 12/01/10 22:22:18 (18 months ago)
- Files:
-
- 1 modified
-
branches/1.5/content/themes/default/settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/content/themes/default/settings.php
r2251 r2274 2 2 // settings.php 3 3 4 // currently active theme, not necessarily the one we're viewing.5 $cTheme = rtrim(THEME, '/');6 7 4 // theme we're viewing the settings for. 8 $ vTheme = $h->cage->get->testAlnumLines('theme');5 $theme_name = $h->cage->get->testAlnumLines('theme'); 9 6 10 7 // If the form has been submitted, save the data... 11 8 if ($h->cage->post->getAlpha('submitted') == 'true') { 12 $error = ''; 13 14 if ($h->cage->post->keyExists('tagline')) { 9 if (!$h->cage->post->keyExists('tagline')) { 10 $h->showMessage('Invalid tagline', 'red'); 11 12 } else { 15 13 $theme_settings['tagline'] = $h->cage->post->getHtmLawed('tagline'); 16 } else { 17 $error = 'Invalid tagline'; 18 } 19 20 if ($error) { 21 $h->showMessage($error, 'red'); 22 } else { 23 $h->updateThemeSettings($theme_settings, $vTheme); 14 $h->updateThemeSettings($theme_settings, $theme_name); 24 15 $h->showMessage('Settings updated', 'green'); 25 16 } 26 } 27 28 // If the user wants to revert to the defaults... 29 if ($h->cage->get->getAlpha('reset') == 'true') { 30 $theme_settings = $h->getThemeSettings($vTheme, 'default'); 31 $h->updateThemeSettings($theme_settings, $vTheme, 'value'); 17 } elseif ($h->cage->get->getAlpha('reset') == 'true') { 18 // The user wants to revert to the defaults 19 $theme_settings = $h->getThemeSettings($theme_name, 'default'); 20 $h->updateThemeSettings($theme_settings, $theme_name, 'value'); 32 21 $h->showMessage('Reverted to default settings', 'green'); 33 22 } 34 23 35 // Default settings:36 $defaults['tagline'] = "Possibly the greatest site on the Internet.";37 38 24 // Get settings from database if they exist... 39 $theme_settings = $h->getThemeSettings($ vTheme);25 $theme_settings = $h->getThemeSettings($theme_name); 40 26 if (!$theme_settings) { 27 // Default settings: 28 $theme_settings = array('tagline'=>'Possibly the greatest site on the Internet'); 41 29 // inserts settings for the first time 42 $h->updateThemeSettings($ defaults, $vTheme, 'both');30 $h->updateThemeSettings($theme_settings, $theme_name, 'both'); 43 31 // use the defaults 44 $theme_settings = $defaults;45 32 } 46 33 ?> 47 48 <form name='theme_settings_form' action='<?php echo BASEURL; ?>admin_index.php?page=theme_settings&theme=<?php echo $vTheme; ?>' method='post'> 49 <p>Tagline: <input type='text' size="70" name='tagline' value='<?php echo $theme_settings['tagline']; ?>'></p> 50 <br /> 51 <input type='hidden' name='submitted' value='true' /> 52 <input type='submit' value='<?php echo $h->lang["main_form_save"]; ?>' /> 53 <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> 34 <form name="theme_settings_form" action="<?php echo BASEURL; ?>admin_index.php?page=theme_settings&theme=<?php echo $theme_name; ?>" method="post"> 35 <label>Tagline: <input type="text" size="70" name="tagline" value="<?php echo htmlentities($theme_settings['tagline'], ENT_QUOTES, 'UTF-8'); ?>"></label> 36 <input type="submit" value="<?php echo $h->lang['main_form_save']; ?>" /> 37 <input type="hidden" name="submitted" value="true" /><input type="hidden" name="csrf" value="<?php echo $h->csrfToken; ?>" /> 54 38 </form> 55 39 <br /> 56 <a href="<?php echo BASEURL; ?>admin_index.php?page=theme_settings&theme=<?php echo $ vTheme; ?>&reset=true"><?php echo $h->lang["admin_theme_theme_revert_settings"]; ?></a>40 <a href="<?php echo BASEURL; ?>admin_index.php?page=theme_settings&theme=<?php echo $theme_name; ?>&reset=true"><?php echo $h->lang["admin_theme_theme_revert_settings"]; ?></a>