Make WordPress Core


Ignore:
Timestamp:
04/19/2004 08:09:27 AM (21 years ago)
Author:
saxmatt
Message:

Massive admin tweak commit. Improved consistency, numerous bug fixes, redesigned link forms, tweaked options more, left the ugly grey bar I didn't mean to add in the first place but tweaked it too.

File:
1 edited

Legend:

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

    r957 r1100  
    1111    $wpvar = $wpvarstoreset[$i];
    1212    if (!isset($$wpvar)) {
    13         if (empty($HTTP_POST_VARS["$wpvar"])) {
    14             if (empty($HTTP_GET_VARS["$wpvar"])) {
     13        if (empty($_POST["$wpvar"])) {
     14            if (empty($_GET["$wpvar"])) {
    1515                $$wpvar = '';
    1616            } else {
    17                 $$wpvar = $HTTP_GET_VARS["$wpvar"];
     17                $$wpvar = $_GET["$wpvar"];
    1818            }
    1919        } else {
    20             $$wpvar = $HTTP_POST_VARS["$wpvar"];
     20            $$wpvar = $_POST["$wpvar"];
    2121        }
    2222    }
     
    3232          die ("Cheatin' uh ?");
    3333
    34       $cat_name = addslashes($HTTP_POST_VARS['cat_name']);
    35       $auto_toggle = $HTTP_POST_VARS['auto_toggle'];
     34      $cat_name = addslashes($_POST['cat_name']);
     35      $auto_toggle = $_POST['auto_toggle'];
    3636      if ($auto_toggle != 'Y') {
    3737          $auto_toggle = 'N';
    3838      }
    3939
    40       $show_images = $HTTP_POST_VARS['show_images'];
     40      $show_images = $_POST['show_images'];
    4141      if ($show_images != 'Y') {
    4242          $show_images = 'N';
    4343      }
    4444
    45       $show_description = $HTTP_POST_VARS['show_description'];
     45      $show_description = $_POST['show_description'];
    4646      if ($show_description != 'Y') {
    4747          $show_description = 'N';
    4848      }
    4949
    50       $show_rating = $HTTP_POST_VARS['show_rating'];
     50      $show_rating = $_POST['show_rating'];
    5151      if ($show_rating != 'Y') {
    5252          $show_rating = 'N';
    5353      }
    5454
    55       $show_updated = $HTTP_POST_VARS['show_updated'];
     55      $show_updated = $_POST['show_updated'];
    5656      if ($show_updated != 'Y') {
    5757          $show_updated = 'N';
    5858      }
    5959
    60       $sort_order = $HTTP_POST_VARS['sort_order'];
    61 
    62       $sort_desc = $HTTP_POST_VARS['sort_desc'];
     60      $sort_order = $_POST['sort_order'];
     61
     62      $sort_desc = $_POST['sort_desc'];
    6363      if ($sort_desc != 'Y') {
    6464          $sort_desc = 'N';
    6565      }
    66       $text_before_link = addslashes($HTTP_POST_VARS['text_before_link']);
    67       $text_after_link = addslashes($HTTP_POST_VARS['text_after_link']);
    68       $text_after_all = addslashes($HTTP_POST_VARS['text_after_all']);
    69 
    70       $list_limit = $HTTP_POST_VARS['list_limit'];
     66      $text_before_link = addslashes($_POST['text_before_link']);
     67      $text_after_link = addslashes($_POST['text_after_link']);
     68      $text_after_all = addslashes($_POST['text_after_all']);
     69
     70      $list_limit = $_POST['list_limit'];
    7171      if ($list_limit == '')
    7272          $list_limit = -1;
     
    8686    include_once('admin-header.php');
    8787
    88     $cat_id = $HTTP_GET_VARS['cat_id'];
     88    $cat_id = $_GET['cat_id'];
    8989    $cat_name=get_linkcatname($cat_id);
    9090    $cat_name=addslashes($cat_name);
     
    105105  {
    106106    include_once ('admin-header.php');
    107     $cat_id = $HTTP_GET_VARS['cat_id'];
     107    $cat_id = $_GET['cat_id'];
    108108    $row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
    109109         . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
     
    123123
    124124<div class="wrap">
    125   <h3>Edit Link Category &#8220;<?php echo $row->cat_name?>&#8221;</h3>
    126   <p>
     125  <h2>Edit &#8220;<?php echo $row->cat_name?>&#8221; Category </h2>
     126
    127127  <form name="editcat" method="post">
    128128      <input type="hidden" name="action" value="editedcat" />
    129129      <input type="hidden" name="cat_id" value="<?php echo $row->cat_id ?>" />
    130     <table border="0">
    131       <tr>
    132         <td align="right">Name:</td>
    133         <td><input type="text" name="cat_name" size="25" value="<?php echo stripslashes($row->cat_name)?>" />&nbsp;&nbsp;&nbsp;
    134             <label for="auto_toggle">
    135 <input type="checkbox" name="auto_toggle" id="auto_toggle" <?php echo ($row->auto_toggle == 'Y') ? 'checked' : '';?> value="Y" />
    136 auto-toggle?</label></td>
    137       </tr>
    138       <tr>
    139         <td align="right">Show:</td>
     130<fieldset class="options">
     131<legend>Category Options</legend>
     132<table class="editform" width="100%" cellspacing="2" cellpadding="5">
     133<tr>
     134    <th width="33%" scope="row">Name:</th>
     135    <td width="67%"><input name="cat_name" type="text" value="<?php echo stripslashes($row->cat_name)?>" size="30" /></td>
     136</tr>
     137<tr>
     138    <th scope="row">Show:</th>
    140139        <td>
    141           <label for="show_images">
    142           <input type="checkbox" name="show_images" id="show_images"  <?php echo ($row->show_images  == 'Y') ? 'checked' : '';?> value="Y" />
    143           images</label>&nbsp;
    144           <label for="show_description">
    145 <input type="checkbox" name="show_description" id="show_description" <?php echo ($row->show_description == 'Y') ? 'checked' : '';?> value="Y" />
    146 description</label>          &nbsp;
    147           <label for="show_rating">
    148 <input type="checkbox" name="show_rating" id="show_rating" <?php echo ($row->show_rating  == 'Y') ? 'checked' : '';?>     value="Y" />
    149 rating</label>          &nbsp;
    150           <label for="show_updated">
    151 <input type="checkbox" name="show_updated" id="show_updated" <?php echo ($row->show_updated == 'Y') ? 'checked' : '';?>     value="Y" />
    152 updated</label>
    153         </td>
    154       </tr>
    155       <tr>
    156         <td align="right">Sort by:</td>
    157         <td>
    158           <select name="sort_order" size="1">
     140            <label>
     141            <input type="checkbox" name="show_images"  value="Y" <?php checked('Y', $row->show_images); ?> />
     142            Image</label> <br />
     143            <label>
     144            <input type="checkbox" name="show_description" value="Y" <?php checked('Y', $row->show_description); ?> />
     145            Description</label>
     146            (shown in <code>title</code> regardless)<br />
     147            <label>
     148            <input type="checkbox" name="show_rating"  value="Y" <?php checked('Y', $row->show_rating); ?> />
     149            Rating</label> <br />
     150            <label>
     151            <input type="checkbox" name="show_updated" value="Y" <?php checked('Y', $row->show_updated); ?> />
     152            Updated</label>
     153(shown in <code>title</code> regardless)</td>
     154</tr>
     155<tr>
     156    <th scope="row">Sort order:</th>
     157    <td>
     158    <select name="sort_order" size="1">
    159159            <option value="name"    <?php echo ($row->sort_order == 'name') ? 'selected' : ''?>>Name</option>
    160160            <option value="id"      <?php echo ($row->sort_order == 'id') ? 'selected' : ''?>>Id</option>
     
    164164            <option value="rand"  <?php echo ($row->sort_order == 'rand') ? 'selected' : ''?>>Random</option>
    165165            <option value="length"  <?php echo ($row->sort_order == 'length') ? 'selected' : ''?>>Name Length</option>
    166           </select>&nbsp;&nbsp;
    167           <input type="checkbox" name="sort_desc" <?php echo ($row->sort_desc  == 'Y') ? 'checked' : '';?> value="Y" /> Descending?<br />
    168         </td>
    169       </tr>
    170       <tr>
    171         <td align="center">Text/HTML</td>
    172         <td>&nbsp;</td>
    173       </tr>
    174       <tr>
    175         <td align="right">Before:</td>
    176         <td><input type="text" name="text_before_link" size="45" value="<?php echo stripslashes($row->text_before_link)?>" /></td>
    177       </tr>
    178       <tr>
    179         <td align="right">Between:</td>
    180         <td><input type="text" name="text_after_link" size="45" value="<?php echo stripslashes($row->text_after_link)?>" /></td>
    181       </tr>
    182       <tr>
    183         <td align="right">After:</td>
    184         <td><input type="text" name="text_after_all" size="45" value="<?php echo stripslashes($row->text_after_all)?>" /></td>
    185       </tr>
    186       <tr>
    187         <td align="right">Limit:</td>
    188         <td><input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit?>"/>          (How many links are shown. Empty for unlimited.)</td>
    189       </tr>
    190       <tr>
    191         <td align="center" colspan="2">
    192           <input type="submit" name="submit" value="Save" class="search" />&nbsp;
    193           <input type="submit" name="submit" value="Cancel" class="search">
    194         </td>
    195       </tr>
    196     </table>
    197   </form>
    198   </p>
     166    </select>
     167    <label>
     168    <input type="checkbox" name="sort_desc" value="Y" <?php checked('Y', $row->sort_desc); ?> />
     169    Descending</label>
     170    </td>
     171</tr>
     172<tr>
     173    <th scope="row">Limit:</th>
     174    <td>
     175    <input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit ?>" />
     176    (Leave empty for no limit to number of links shown)
     177    </td>
     178</tr>
     179<tr>
     180    <th scope="row">Toggle:</th>
     181    <td><label>
     182        <input type="checkbox" name="auto_toggle"  value="Y" <?php checked('Y', $row->auto_toggle); ?> />
     183        When new link is added toggle all others to be invisible</label></td>
     184</tr>
     185
     186</table>
     187</fieldset>
     188<fieldset class="options">
     189<legend>Formatting</legend>
     190<table class="editform" width="100%" cellspacing="2" cellpadding="5">
     191<tr>
     192    <th width="33%" scope="row">Before Link:</th>
     193    <td width="67%"><input type="text" name="text_before_link" size="45" value="<?php echo stripslashes($row->text_before_link)?>" /></td>
     194</tr>
     195<tr>
     196<th scope="row">Between Link and Description:</th>
     197<td><input type="text" name="text_after_link" size="45" value="<?php echo stripslashes($row->text_after_link)?>" /></td>
     198</tr>
     199<tr>
     200<th scope="row">After Link:</th>
     201<td><input type="text" name="text_after_all" size="45" value="<?php echo stripslashes($row->text_after_all)?>"/></td>
     202</tr>
     203</table>
     204</fieldset>
     205<p class="submit"><input type="submit" name="submit" value="Save Category Settings &raquo;" /></p>
     206</form>
     207
    199208</div>
    200209<?php
     
    210219      die ("Cheatin' uh ?");
    211220
    212     $submit=$HTTP_POST_VARS["submit"];
    213     if (isset($submit) && ($submit == "Save")) {
    214 
    215     $cat_id=$HTTP_POST_VARS["cat_id"];
    216 
    217     $cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
    218     $auto_toggle = $HTTP_POST_VARS["auto_toggle"];
     221    $submit=$_POST["submit"];
     222    if (isset($submit)) {
     223
     224    $cat_id=$_POST["cat_id"];
     225
     226    $cat_name=addslashes(stripslashes($_POST["cat_name"]));
     227    $auto_toggle = $_POST["auto_toggle"];
    219228    if ($auto_toggle != 'Y') {
    220229        $auto_toggle = 'N';
    221230    }
    222231
    223     $show_images = $HTTP_POST_VARS["show_images"];
     232    $show_images = $_POST["show_images"];
    224233    if ($show_images != 'Y') {
    225234        $show_images = 'N';
    226235    }
    227236
    228     $show_description = $HTTP_POST_VARS["show_description"];
     237    $show_description = $_POST["show_description"];
    229238    if ($show_description != 'Y') {
    230239        $show_description = 'N';
    231240    }
    232241
    233     $show_rating = $HTTP_POST_VARS["show_rating"];
     242    $show_rating = $_POST["show_rating"];
    234243    if ($show_rating != 'Y') {
    235244        $show_rating = 'N';
    236245    }
    237246
    238     $show_updated = $HTTP_POST_VARS["show_updated"];
     247    $show_updated = $_POST["show_updated"];
    239248    if ($show_updated != 'Y') {
    240249        $show_updated = 'N';
    241250    }
    242251
    243     $sort_order = $HTTP_POST_VARS["sort_order"];
    244 
    245     $sort_desc = $HTTP_POST_VARS["sort_desc"];
     252    $sort_order = $_POST["sort_order"];
     253
     254    $sort_desc = $_POST["sort_desc"];
    246255    if ($sort_desc != 'Y') {
    247256        $sort_desc = 'N';
    248257    }
    249     $text_before_link = addslashes($HTTP_POST_VARS["text_before_link"]);
    250     $text_after_link = addslashes($HTTP_POST_VARS["text_after_link"]);
    251     $text_after_all = addslashes($HTTP_POST_VARS["text_after_all"]);
    252 
    253     $list_limit = $HTTP_POST_VARS["list_limit"];
     258    $text_before_link = addslashes($_POST["text_before_link"]);
     259    $text_after_link = addslashes($_POST["text_after_link"]);
     260    $text_after_all = addslashes($_POST["text_after_all"]);
     261
     262    $list_limit = $_POST["list_limit"];
    254263    if ($list_limit == '')
    255264        $list_limit = -1;
     
    291300</ul>
    292301<div class="wrap">
    293 
    294           <form name="cats" method="post" action="link-categories.php">
    295             <strong>Edit</strong> a link category:<?php echo gethelp_link($this_file,'edit_link_category');?><br />
     302            <h2>Link Categories:<?php echo gethelp_link($this_file,'edit_link_category');?></h2>
    296303            <table width="100%" cellpadding="5" cellspacing="0" border="0">
    297304              <tr>
    298305              <th rowspan="2" valign="bottom">Name</th>
    299                 <th rowspan="2" valign="bottom">Id</th>
    300                 <th rowspan="2" valign="bottom">Auto<br />Toggle?</th>
     306                <th rowspan="2" valign="bottom">ID</th>
     307                <th rowspan="2" valign="bottom">Toggle?</th>
    301308                <th colspan="4" valign="bottom">Show</th>
    302309                <th rowspan="2" valign="bottom">Sort Order</th>
    303310                <th rowspan="2" valign="bottom">Desc?</th>
    304                 <th colspan="3" valign="bottom">Text/HTML</th>
     311                <th colspan="3" valign="bottom">Formatting</th>
    305312                <th rowspan="2" valign="bottom">Limit</th>
    306313                <th rowspan="2" colspan="2">&nbsp;</th>
    307314              </tr>
    308315              <tr>
    309                 <th valign="top">images?</th>
    310                 <th valign="top">desc?</th>
    311                 <th valign="top">rating?</th>
    312                 <th valign="top">updated?</th>
    313                 <th valign="top">before</th>
    314                 <th valign="top">between</th>
    315                 <th valign="top">after</th>
     316                <th valign="top">Images</th>
     317                <th valign="top">Desc.</th>
     318                <th valign="top">Rating</th>
     319                <th valign="top">Updated</th>
     320                <th valign="top">Before</th>
     321                <th valign="top">Between</th>
     322                <th valign="top">After</th>
    316323              </tr>
    317                 <input type="hidden" name="cat_id" value="" />
    318                 <input type="hidden" name="action" value="" />
    319324<?php
    320325$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
    321326         . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
    322327         . " text_after_all, list_limit FROM $tablelinkcategories ORDER BY cat_id");
     328$i = 1;
    323329foreach ($results as $row) {
    324330    if ($row->list_limit == -1) {
     
    349355?>
    350356            </table>
    351         </form>
     357<p>These are the defaults for when you call a link category with no additional arguments. All of these settings may be overwritten.</p>
    352358
    353359</div>
     
    356362    <form name="addcat" method="post">
    357363      <input type="hidden" name="action" value="addcat" />
    358       <h3>Add a Link Category:<?php echo gethelp_link($this_file,'add_link_category');?></h3>
    359     <table width="100%" cellpadding="5" cellspacing="0" border="0">
    360       <tr>
    361         <td align="right">Name:</td>
    362         <td><input type="text" name="cat_name" size="25" />&nbsp;&nbsp;&nbsp;
    363             <input type="checkbox" name="auto_toggle"  value="Y" /> auto-toggle?</td>
    364       </tr>
    365       <tr>
    366         <td align="right">Show:</td>
     364      <h2>Add a Link Category:<?php echo gethelp_link($this_file,'add_link_category');?></h2>
     365<fieldset class="options">
     366<legend>Category Options</legend>
     367<table class="editform" width="100%" cellspacing="2" cellpadding="5">
     368<tr>
     369    <th width="33%" scope="row">Name:</th>
     370    <td width="67%"><input type="text" name="cat_name" size="30" /></td>
     371</tr>
     372<tr>
     373    <th scope="row">Show:</th>
    367374        <td>
    368           <input type="checkbox" name="show_images"  value="Y" /> images&nbsp;&nbsp;
    369           <input type="checkbox" name="show_description"    value="Y" /> description&nbsp;&nbsp;
    370           <input type="checkbox" name="show_rating"  value="Y" /> rating&nbsp;&nbsp;
    371           <input type="checkbox" name="show_updated" value="Y" /> updated</td>
    372       </tr>
    373       <tr>
    374         <td align="right">Sort order:</td>
    375         <td>
    376             <select name="sort_order" size="1">
    377               <option value="name">Name</option>
    378               <option value="id">Id</option>
    379               <option value="url">URL</option>
    380               <option value="rating">Rating</option>
    381               <option value="updated">Updated</option>
    382               <option value="rand">Random</option>
    383             </select>&nbsp;&nbsp;
    384             <input type="checkbox" name="sort_desc" value="N" /> Descending?<br />
    385           </td>
    386       </tr>
    387       <tr>
    388         <td align="center">Text/HTML</td>
    389         <td>&nbsp;</td>
    390       </tr>
    391       <tr>
    392         <td align="right">before:</td>
    393         <td><input type="text" name="text_before_link" size="45" value="&lt;li&gt;"/></td>
    394       </tr>
    395       <tr>
    396         <td align="right">between:</td>
    397         <td><input type="text" name="text_after_link" size="45" value="&lt;br /&gt;" /></td>
    398       </tr>
    399       <tr>
    400         <td align="right">after:</td>
    401         <td><input type="text" name="text_after_all" size="45" value="&lt;/li&gt;"/></td>
    402       </tr>
    403       <tr>
    404         <td align="right">limit:</td>
    405         <td><input type="text" name="list_limit" size="5" value=""/> (leave empty for no limit)</td>
    406       </tr>
    407       <tr>
    408         <td align="center" colspan="2"><input type="submit" name="submit" value="Add Category!" class="search" /></td>
    409       </tr>
    410     </table>
     375            <label>
     376            <input type="checkbox" name="show_images"  value="Y" />
     377            Image</label> <br />
     378            <label>
     379            <input type="checkbox" name="show_description" value="Y" />
     380            Description</label>
     381            (shown in <code>title</code> regardless)<br />
     382            <label>
     383            <input type="checkbox" name="show_rating"  value="Y" />
     384            Rating</label> <br />
     385            <label>
     386            <input type="checkbox" name="show_updated" value="Y" />
     387            Updated</label>
     388(shown in <code>title</code> regardless)</td>
     389</tr>
     390<tr>
     391    <th scope="row">Sort order:</th>
     392    <td>
     393    <select name="sort_order" size="1">
     394    <option value="name">Name</option>
     395    <option value="id">Id</option>
     396    <option value="url">URL</option>
     397    <option value="rating">Rating</option>
     398    <option value="updated">Updated</option>
     399    <option value="rand">Random</option>
     400    </select>
     401    <label>
     402    <input type="checkbox" name="sort_desc" value="Y" />
     403    Descending</label>
     404    </td>
     405</tr>
     406<tr>
     407    <th scope="row">Limit:</th>
     408    <td>
     409    <input type="text" name="list_limit" size="5" value="" /> (Leave empty for no limit to number of links shown)
     410    </td>
     411</tr>
     412<tr>
     413    <th scope="row">Toggle:</th>
     414    <td><label>
     415        <input type="checkbox" name="auto_toggle"  value="Y" />
     416        When new link is added toggle all others to be invisible</label></td>
     417</tr>
     418
     419</table>
     420</fieldset>
     421<fieldset class="options">
     422<legend>Formatting</legend>
     423<table class="editform" width="100%" cellspacing="2" cellpadding="5">
     424<tr>
     425    <th width="33%" scope="row">Before Link:</th>
     426    <td width="67%"><input type="text" name="text_before_link" size="45" value="&lt;li&gt;" /></td>
     427</tr>
     428<tr>
     429<th scope="row">Between Link and Description:</th>
     430<td><input type="text" name="text_after_link" size="45" value="&lt;br /&gt;" /></td>
     431</tr>
     432<tr>
     433<th scope="row">After Link:</th>
     434<td><input type="text" name="text_after_all" size="45" value="&lt;/li&gt;"/></td>
     435</tr>
     436</table>
     437</fieldset>
     438<p class="submit"><input type="submit" name="submit" value="Add Category &raquo;" /></p>
    411439  </form>
    412440</div>
Note: See TracChangeset for help on using the changeset viewer.