Make WordPress Core


Ignore:
Timestamp:
12/12/2004 08:41:19 PM (21 years ago)
Author:
saxmatt
Message:

Axing htmlspecialchars because it double-encodes-encodes. Better error handling around queries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-add.php

    r1818 r1940  
    22require_once('admin.php');
    33
    4 $title = 'Add Link';
     4$title = __('Add Link');
    55$this_file = 'link-manager.php';
    66$parent_file = 'link-manager.php';
    77
    88function category_dropdown($fieldname, $selected = 0) {
    9     global $wpdb;
    10 
    11     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
    12     echo '        <select name="'.$fieldname.'" size="1">'."\n";
    13     foreach ($results as $row) {
    14       echo "          <option value=\"".$row->cat_id."\"";
    15       if ($row->cat_id == $selected)
    16         echo " selected";
    17         echo ">".$row->cat_id.": ".htmlspecialchars($row->cat_name);
    18         if ($row->auto_toggle == 'Y')
    19             echo ' (auto toggle)';
    20         echo "</option>\n";
    21     }
    22     echo "        </select>\n";
     9    global $wpdb;
     10   
     11    $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
     12    echo "\n<select name='$fieldname' size='1'>\n";
     13    foreach ($results as $row) {
     14        echo "\n\t<option value='$row->cat_id'";
     15        if ($row->cat_id == $selected)
     16            echo " selected='selected'";
     17        echo ">$row->cat_id : " . wp_specialchars($row->cat_name);
     18        if ($row->auto_toggle == 'Y')
     19            echo ' (auto toggle)';
     20        echo "</option>";
     21    }
     22    echo "\n</select>\n";
    2323}
    2424
     
    5050
    5151<?php if ($_GET['added']) : ?>
    52 <div class="updated"><p>Link added.</p></div>
     52<div class="updated"><p><?php _e('Link added.'); ?></p></div>
    5353<?php endif; ?>
    5454<div class="wrap">
     
    6060         <tr>
    6161           <th width="33%" scope="row"><?php _e('URI:') ?></th>
    62            <td width="67%"><input type="text" name="linkurl" value="<?php echo $_GET['linkurl']; ?>" style="width: 95%;" /></td>
     62           <td width="67%"><input type="text" name="linkurl" value="<?php echo wp_specialchars($_GET['linkurl'], 1); ?>" style="width: 95%;" /></td>
    6363         </tr>
    6464         <tr>
    6565           <th scope="row"><?php _e('Link Name:') ?></th>
    66            <td><input type="text" name="name" value="<?php echo urldecode($_GET['name']); ?>" style="width: 95%" /></td>
     66           <td><input type="text" name="name" value="<?php echo wp_specialchars( urldecode($_GET['name']), 1 ); ?>" style="width: 95%" /></td>
    6767         </tr>
    6868         <tr>
Note: See TracChangeset for help on using the changeset viewer.