Changeset 2274 for branches

Show
Ignore:
Timestamp:
12/01/10 22:22:18 (18 months ago)
Author:
petsagouris
Message:

[Branch 1.5] Fixed the default theme apostrophe bug. close #164

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/1.5/content/themes/default/settings.php

    r2251 r2274  
    22// settings.php 
    33 
    4 // currently active theme, not necessarily the one we're viewing. 
    5 $cTheme = rtrim(THEME, '/'); 
    6  
    74// theme we're viewing the settings for. 
    8 $vTheme = $h->cage->get->testAlnumLines('theme'); 
     5$theme_name = $h->cage->get->testAlnumLines('theme'); 
    96 
    107// If the form has been submitted, save the data... 
    118if ($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 { 
    1513                $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); 
    2415                $h->showMessage('Settings updated', 'green'); 
    2516        } 
    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'); 
    3221        $h->showMessage('Reverted to default settings', 'green'); 
    3322} 
    3423 
    35 // Default settings: 
    36 $defaults['tagline'] = "Possibly the greatest site on the Internet."; 
    37  
    3824// Get settings from database if they exist... 
    39 $theme_settings = $h->getThemeSettings($vTheme); 
     25$theme_settings = $h->getThemeSettings($theme_name); 
    4026if (!$theme_settings) { 
     27        // Default settings: 
     28        $theme_settings = array('tagline'=>'Possibly the greatest site on the Internet'); 
    4129        // inserts settings for the first time 
    42         $h->updateThemeSettings($defaults, $vTheme, 'both'); 
     30        $h->updateThemeSettings($theme_settings, $theme_name, 'both'); 
    4331        // use the defaults 
    44         $theme_settings = $defaults; 
    4532} 
    4633?> 
    47  
    48 <form name='theme_settings_form' action='<?php echo BASEURL; ?>admin_index.php?page=theme_settings&amp;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&amp;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; ?>" /> 
    5438</form> 
    5539<br /> 
    56 <a href="<?php echo BASEURL; ?>admin_index.php?page=theme_settings&amp;theme=<?php echo $vTheme; ?>&amp;reset=true"><?php echo $h->lang["admin_theme_theme_revert_settings"]; ?></a> 
     40<a href="<?php echo BASEURL; ?>admin_index.php?page=theme_settings&amp;theme=<?php echo $theme_name; ?>&amp;reset=true"><?php echo $h->lang["admin_theme_theme_revert_settings"]; ?></a>