Log in with username/password: lyceum/lyceum

Changeset 1250

Show
Ignore:
Timestamp:
10/25/07 01:18:52 (1 year ago)
Author:
jjb
Message:

Configurable example post and page titles, proper escaping of options.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/src/lib/lyceum-registration-functions.php

    r1249 r1250  
    5656      $now_gmt = gmdate('Y-m-d H:i:s'); 
    5757      $post_content = $wpdb->escape(__(get_settings('example_post_body'))); 
    58       $post_title = $wpdb->escape(__('Hello world!')); 
     58      $post_title = $wpdb->escape(__(get_settings('example_post_title'))); 
    5959      $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt, comment_count) VALUES ($userid, '$now', '$now_gmt', '".$post_content."', '".$post_title."', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1')"); 
    6060      $postid=$wpdb->insert_id; 
     
    8585   if( get_settings('create_example_page')){ 
    8686      // First Page 
    87       $page_title = $wpdb->escape(__('About page example -- edit me!')); 
     87      $page_title = $wpdb->escape(__(get_settings('example_page_title'))); 
    8888      $page_content = $wpdb->escape(__(get_settings('example_page_body'))); 
    8989      $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt, post_status, page_blog) VALUES ($userid, '$now', '$now_gmt', '".$page_content."', '".$page_title."', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '$blog')"); 
  • branches/1.0/src/lyceum/system-admin/setoption.php

    r1019 r1250  
    1111$_POST['value'] = preg_replace('|[;#]|', '', $_POST['value']);//since this script handles all the data coming in from settings.php, this can't be much more comprehensive 
    1212 
    13 update_option($_POST['option'], stripslashes($_POST['value'])); 
     13update_option($_POST['option'], $wpdb->unescape($_POST['value'])); 
    1414 
    1515header("Location: settings.php"); 
  • branches/1.0/src/lyceum/system-admin/settings.php

    r1249 r1250  
    331331 
    332332            <form method="post" action="setoption.php" class="lyceum_form"> 
     333               <?php echo tokeninput('setoption.php', 'example_post_title')?> 
     334               <input type="hidden" name="option" value="example_post_title" /> 
     335 
     336               <table class="FormTable"> 
     337                  <col width="20%" /> 
     338                  <col width="80%" /> 
     339 
     340                  <tbody> 
     341                     <tr> 
     342                        <th scope="row"><label for="example_post_title">Example post title</label></th> 
     343                        <td> 
     344                           <input type="text" name="value" id="example_post_title" maxlength="100" value="<?php echo  get_option('example_post_title') ?>" class="TextInput" /> 
     345                           <input type="submit" value="Submit" name="submit" class="Button" /> 
     346                           <div class="HelpText">The title of the example post.</div> 
     347                        </td> 
     348                     </tr> 
     349                  </tbody> 
     350               </table> 
     351            </form> 
     352 
     353 
     354            <form method="post" action="setoption.php" class="lyceum_form"> 
    333355               <?php echo tokeninput('setoption.php', 'example_post_body')?> 
    334356               <input type="hidden" name="option" value="example_post_body" /> 
     
    369391                           <input type="submit" value="Submit" name="submit" class="Button" /> 
    370392                           <div class="HelpText">Should an example page be created when a new blog is created?</div> 
     393                        </td> 
     394                     </tr> 
     395                  </tbody> 
     396               </table> 
     397            </form> 
     398 
     399            <form method="post" action="setoption.php" class="lyceum_form"> 
     400               <?php echo tokeninput('setoption.php', 'example_page_title')?> 
     401               <input type="hidden" name="option" value="example_page_title" /> 
     402 
     403               <table class="FormTable"> 
     404                  <col width="20%" /> 
     405                  <col width="80%" /> 
     406 
     407                  <tbody> 
     408                     <tr> 
     409                        <th scope="row"><label for="example_page_title">Example page title</label></th> 
     410                        <td> 
     411                           <input type="text" name="value" id="example_page_title" maxlength="100" value="<?php echo  get_option('example_page_title') ?>" class="TextInput" /> 
     412                           <input type="submit" value="Submit" name="submit" class="Button" /> 
     413                           <div class="HelpText">The title of the example page.</div> 
    371414                        </td> 
    372415                     </tr> 
  • branches/1.0/src/lyceum/wp-admin/upgrade-schema.php

    r1249 r1250  
    341341   add_option('example_post_body', 'Welcome to ' . get_settings('site_title') . '. This is your first post. Edit or delete it, then start blogging!'); 
    342342   add_option('example_page_body', 'This is an example of a page. You may make as many pages as you like, and even structure them in a hierarchy. It\'s quite possible that you won\'t find a use for pages at all. However, one page you may wish to create is an "About" page, telling your readers a little bit about yourself and what you like to write about. Just edit this page, rename the title to "About", and replace this text. Of course, you may also delete this page entirely if you wish.'); 
     343   add_option('example_post_title', 'Hello world!'); 
     344   add_option('example_page_title', 'About page example -- edit me!'); 
    343345 
    344346   //// this is a little ugly 
Log in with username/password: lyceum/lyceum