More link manager fixes.
git-svn-id: http://svn.automattic.com/wordpress/trunk@656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9a5a4a52de
commit
4d44f4d8e7
|
@ -11,17 +11,17 @@ function category_dropdown($fieldname, $selected = 0) {
|
||||||
global $wpdb, $tablelinkcategories;
|
global $wpdb, $tablelinkcategories;
|
||||||
|
|
||||||
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
|
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
|
||||||
echo ' <select name="'.$fieldname.'" size="1">'."\n";
|
echo "\n<select name='$fieldname' size='1'>";
|
||||||
foreach ($results as $row) {
|
foreach ($results as $row) {
|
||||||
echo " <option value=\"".$row->cat_id."\"";
|
echo "\n\t<option value='$row->cat_id'";
|
||||||
if ($row->cat_id == $selected)
|
if ($row->cat_id == $selected)
|
||||||
echo " selected";
|
echo " selected='selected'";
|
||||||
echo ">".$row->cat_id.": ".$row->cat_name;
|
echo ">$row->cat_id: $row->cat_name";
|
||||||
if ($row->auto_toggle == 'Y')
|
if ('Y' == $row->auto_toggle)
|
||||||
echo ' (auto toggle)';
|
echo ' (auto toggle)';
|
||||||
echo "</option>\n";
|
echo "</option>\n";
|
||||||
}
|
}
|
||||||
echo " </select>\n";
|
echo "\n</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_magic_quotes($array) {
|
function add_magic_quotes($array) {
|
||||||
|
@ -44,6 +44,7 @@ $wpvarstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image
|
||||||
'description', 'visible', 'target', 'category', 'link_id',
|
'description', 'visible', 'target', 'category', 'link_id',
|
||||||
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
|
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
|
||||||
'notes', 'linkcheck[]');
|
'notes', 'linkcheck[]');
|
||||||
|
|
||||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||||
$wpvar = $wpvarstoreset[$i];
|
$wpvar = $wpvarstoreset[$i];
|
||||||
if (!isset($$wpvar)) {
|
if (!isset($$wpvar)) {
|
||||||
|
@ -59,11 +60,12 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$links_show_cat_id = $HTTP_COOKIE_VARS["links_show_cat_id_".$cookiehash];
|
$links_show_cat_id = $HTTP_COOKIE_VARS['links_show_cat_id_' . $cookiehash];
|
||||||
$links_show_order = $HTTP_COOKIE_VARS["links_show_order_".$cookiehash];
|
$links_show_order = $HTTP_COOKIE_VARS['links_show_order_' . $cookiehash];
|
||||||
|
|
||||||
if (!empty($action2))
|
if (!empty($action2)) {
|
||||||
$action = $action2;
|
$action = $action2;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'Assign':
|
case 'Assign':
|
||||||
|
@ -161,16 +163,16 @@ switch ($action) {
|
||||||
$standalone = 1;
|
$standalone = 1;
|
||||||
include_once('admin-header.php');
|
include_once('admin-header.php');
|
||||||
|
|
||||||
$link_url = $HTTP_POST_VARS["linkurl"];
|
$link_url = $HTTP_POST_VARS['linkurl'];
|
||||||
$link_name = $HTTP_POST_VARS["name"];
|
$link_name = $HTTP_POST_VARS['name'];
|
||||||
$link_image = $HTTP_POST_VARS["image"];
|
$link_image = $HTTP_POST_VARS['image'];
|
||||||
$link_target = $HTTP_POST_VARS["target"];
|
$link_target = $HTTP_POST_VARS['target'];
|
||||||
$link_category = $HTTP_POST_VARS["category"];
|
$link_category = $HTTP_POST_VARS['category'];
|
||||||
$link_description = $HTTP_POST_VARS["description"];
|
$link_description = $HTTP_POST_VARS['description'];
|
||||||
$link_visible = $HTTP_POST_VARS["visible"];
|
$link_visible = $HTTP_POST_VARS['visible'];
|
||||||
$link_rating = $HTTP_POST_VARS["rating"];
|
$link_rating = $HTTP_POST_VARS['rating'];
|
||||||
$link_rel = $HTTP_POST_VARS["rel"];
|
$link_rel = $HTTP_POST_VARS['rel'];
|
||||||
$link_notes = $HTTP_POST_VARS["notes"];
|
$link_notes = $HTTP_POST_VARS['notes'];
|
||||||
$auto_toggle = get_autotoggle($link_category);
|
$auto_toggle = get_autotoggle($link_category);
|
||||||
|
|
||||||
if ($user_level < get_settings('links_minadminlevel'))
|
if ($user_level < get_settings('links_minadminlevel'))
|
||||||
|
@ -193,7 +195,7 @@ switch ($action) {
|
||||||
|
|
||||||
case 'editlink':
|
case 'editlink':
|
||||||
{
|
{
|
||||||
if (isset($submit) && ($submit == "Save")) {
|
if (isset($submit)) {
|
||||||
|
|
||||||
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
|
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
|
||||||
$cat_id = $links_show_cat_id;
|
$cat_id = $links_show_cat_id;
|
||||||
|
@ -207,17 +209,17 @@ switch ($action) {
|
||||||
$standalone = 1;
|
$standalone = 1;
|
||||||
include_once('admin-header.php');
|
include_once('admin-header.php');
|
||||||
|
|
||||||
$link_id = $HTTP_POST_VARS["link_id"];
|
$link_id = $HTTP_POST_VARS['link_id'];
|
||||||
$link_url = $HTTP_POST_VARS["linkurl"];
|
$link_url = $HTTP_POST_VARS['linkurl'];
|
||||||
$link_name = $HTTP_POST_VARS["name"];
|
$link_name = $HTTP_POST_VARS['name'];
|
||||||
$link_image = $HTTP_POST_VARS["image"];
|
$link_image = $HTTP_POST_VARS['image'];
|
||||||
$link_target = $HTTP_POST_VARS["target"];
|
$link_target = $HTTP_POST_VARS['target'];
|
||||||
$link_category = $HTTP_POST_VARS["category"];
|
$link_category = $HTTP_POST_VARS['category'];
|
||||||
$link_description = $HTTP_POST_VARS["description"];
|
$link_description = $HTTP_POST_VARS['description'];
|
||||||
$link_visible = $HTTP_POST_VARS["visible"];
|
$link_visible = $HTTP_POST_VARS['visible'];
|
||||||
$link_rating = $HTTP_POST_VARS["rating"];
|
$link_rating = $HTTP_POST_VARS['rating'];
|
||||||
$link_rel = $HTTP_POST_VARS["rel"];
|
$link_rel = $HTTP_POST_VARS['rel'];
|
||||||
$link_notes = $HTTP_POST_VARS["notes"];
|
$link_notes = $HTTP_POST_VARS['notes'];
|
||||||
$auto_toggle = get_autotoggle($link_category);
|
$auto_toggle = get_autotoggle($link_category);
|
||||||
|
|
||||||
if ($user_level < get_settings('links_minadminlevel'))
|
if ($user_level < get_settings('links_minadminlevel'))
|
||||||
|
@ -248,12 +250,12 @@ switch ($action) {
|
||||||
$standalone = 1;
|
$standalone = 1;
|
||||||
include_once('admin-header.php');
|
include_once('admin-header.php');
|
||||||
|
|
||||||
$link_id = $HTTP_POST_VARS["link_id"];
|
$link_id = $HTTP_GET_VARS["link_id"];
|
||||||
|
|
||||||
if ($user_level < get_settings('links_minadminlevel'))
|
if ($user_level < get_settings('links_minadminlevel'))
|
||||||
die ("Cheatin' uh ?");
|
die ("Cheatin' uh ?");
|
||||||
|
|
||||||
$wpdb->query("DELETE FROM $tablelinks WHERE link_id = '$link_id'");
|
$wpdb->query("DELETE FROM $tablelinks WHERE link_id = $link_id");
|
||||||
|
|
||||||
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
|
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
|
||||||
$cat_id = $links_show_cat_id;
|
$cat_id = $links_show_cat_id;
|
||||||
|
@ -273,12 +275,12 @@ switch ($action) {
|
||||||
$standalone=0;
|
$standalone=0;
|
||||||
include_once ('admin-header.php');
|
include_once ('admin-header.php');
|
||||||
if ($user_level < get_settings('links_minadminlevel')) {
|
if ($user_level < get_settings('links_minadminlevel')) {
|
||||||
die("You have no right to edit the links for this blog.<br />Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a>. :)");
|
die("You have no right to edit the links for this blog.<br />Ask for a promotion to your <a href='mailto:$admin_email'>blog admin</a>. :)");
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = $wpdb->get_row("SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel, link_notes " .
|
$row = $wpdb->get_row("SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel, link_notes
|
||||||
" FROM $tablelinks " .
|
FROM $tablelinks
|
||||||
" WHERE link_id = $link_id");
|
WHERE link_id = $link_id");
|
||||||
|
|
||||||
if ($row) {
|
if ($row) {
|
||||||
$link_url = stripslashes($row->link_url);
|
$link_url = stripslashes($row->link_url);
|
||||||
|
@ -300,45 +302,40 @@ switch ($action) {
|
||||||
<li><a href="link-categories.php">Link Categories</a></li>
|
<li><a href="link-categories.php">Link Categories</a></li>
|
||||||
<li class="last"><a href="link-import.php">Import Blogroll</a></li>
|
<li class="last"><a href="link-import.php">Import Blogroll</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<style media="screen" type="text/css">
|
||||||
|
th { text-align: right; }
|
||||||
|
</style>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
|
<form action="" method="post" name="editlink" id="editlink">
|
||||||
<table width="100%" cellpadding="3" cellspacing="3">
|
<h3>Edit a link:</h3>
|
||||||
<form name="editlink" method="post">
|
<table width="100%" border="0" cellspacing="5" cellpadding="3">
|
||||||
<input type="hidden" name="action" value="editlink" />
|
|
||||||
<input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
|
|
||||||
<input type="hidden" name="order_by" value="<?php echo $order_by ?>" />
|
|
||||||
<input type="hidden" name="cat_id" value="<?php echo $cat_id ?>" />
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><strong>Edit</strong> a link:</td>
|
<th scope="row">URI:</th>
|
||||||
|
<td><input type="text" name="linkurl" size="80" value="<?php echo $link_url; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">URL:</td>
|
<th scope="row">Link Name: </th>
|
||||||
<td><input type="text" name="linkurl" size="80" value="<?php echo $link_url; ?>"></td>
|
<td><input type="text" name="name" size="80" value="<?php echo $link_name; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Display Name/Alt text:</td>
|
<th scope="row">Image:</th>
|
||||||
<td><input type="text" name="name" size="80" value="<?php echo $link_name; ?>"></td>
|
<td><input type="text" name="image" size="80" value="<?php echo $link_image; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Image:</td>
|
<th scope="row">Description:</th>
|
||||||
<td><input type="text" name="image" size="80" value="<?php echo $link_image; ?>"></td>
|
<td><input type="text" name="description" size="80" value="<?php echo $link_description; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Description:</td>
|
<th scope="row">rel:</th>
|
||||||
<td><input type="text" name="description" size="80" value="<?php echo $link_description; ?>"></td>
|
<td><input type="text" name="rel" size="80" value="<?php echo $link_rel; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Rel:</td>
|
<th scope="row">Notes:</th>
|
||||||
<td><input type="text" name="rel" size="80" value="<?php echo $link_rel; ?>"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td valign="top" align="right">Notes:</td>
|
|
||||||
<td><textarea name="notes" cols="80" rows="10"><?php echo $link_notes; ?></textarea></td>
|
<td><textarea name="notes" cols="80" rows="10"><?php echo $link_notes; ?></textarea></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Rating:</td>
|
<th scope="row">Rating:</th>
|
||||||
<td>
|
<td><select name="rating" size="1">
|
||||||
<select name="rating" size="1">
|
|
||||||
<?php
|
<?php
|
||||||
for ($r = 0; $r < 10; $r++) {
|
for ($r = 0; $r < 10; $r++) {
|
||||||
echo(' <option value="'.$r.'" ');
|
echo(' <option value="'.$r.'" ');
|
||||||
|
@ -347,39 +344,46 @@ switch ($action) {
|
||||||
echo('>'.$r.'</option>');
|
echo('>'.$r.'</option>');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select> (Leave at 0 for no rating.)
|
</select> (Leave at 0 for no rating.) </td>
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Target:</td>
|
<th scope="row">Target:</th>
|
||||||
<td><label><input type="radio" name="target" value="_blank" <?php echo(($link_target == '_blank') ? 'checked="checked"' : ''); ?>> _blank</label>
|
|
||||||
<label><input type="radio" name="target" value="_top" <?php echo(($link_target == '_top') ? 'checked="checked"' : ''); ?>> _top</label>
|
|
||||||
<label><input type="radio" name="target" value="" <?php echo(($link_target == '') ? 'checked="checked"' : ''); ?>> none</label>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="right">Visible:</td>
|
|
||||||
<td><label>
|
<td><label>
|
||||||
<input type="radio" name="visible" <?php if ($link_visible == 'Y') echo "checked"; ?> value="Y">
|
<input type="radio" name="target" value="_blank" <?php echo(($link_target == '_blank') ? 'checked="checked"' : ''); ?> />
|
||||||
Yes</label>
|
<code>_blank</code></label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="visible" <?php if ($link_visible == 'N') echo "checked"; ?> value="N">
|
<input type="radio" name="target" value="_top" <?php echo(($link_target == '_top') ? 'checked="checked"' : ''); ?> />
|
||||||
No</label>
|
<code>_top</code></label>
|
||||||
</td>
|
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="target" value="" <?php echo(($link_target == '') ? 'checked="checked"' : ''); ?> />
|
||||||
|
none (Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)</label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><label for="category">Category</label>:</td>
|
<th scope="row">Visible:</th>
|
||||||
<td>
|
<td><label>
|
||||||
<?php category_dropdown('category', $link_category); ?>
|
<input type="radio" name="visible" <?php if ($link_visible == 'Y') echo "checked"; ?> value="Y" />
|
||||||
</td>
|
Yes</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="visible" <?php if ($link_visible == 'N') echo "checked"; ?> value="N" />
|
||||||
|
No</label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" align="center">
|
<th scope="row">Category:</th>
|
||||||
<input type="submit" name="submit" value="Save" class="search">
|
<td><?php category_dropdown('category', $link_category); ?></td>
|
||||||
<input type="submit" name="submit" value="Cancel" class="search">
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
|
<td colspan="2" align="center"><input type="submit" name="submit" value="Save Changes" class="search" />
|
||||||
|
|
||||||
|
<input type="submit" name="submit" value="Cancel" class="search" />
|
||||||
|
<input type="hidden" name="action" value="editlink" />
|
||||||
|
<input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
|
||||||
|
<input type="hidden" name="order_by" value="<?php echo $order_by ?>" />
|
||||||
|
<input type="hidden" name="cat_id" value="<?php echo $cat_id ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue