Added admin configuration of link categories, added functons to use that.

Updated install and upgrade scripts
Added recently updated pre/append text


git-svn-id: http://svn.automattic.com/wordpress/trunk@280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
mikelittle 2003-07-30 14:44:57 +00:00
parent eabfb997e3
commit ce9a4162bc
7 changed files with 509 additions and 129 deletions

View File

@ -0,0 +1,78 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>WordPress &#8212; Docs</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- fix the FOUC -->
<script type="text/javascript"> </script>
<style type="text/css">
@import url("http://wordpress.org/wp.css");
</style>
</head>
<body>
<div id="main">
<h1 id="logo"><a href="/" title="WordPress"><span>WordPress</span></a></h1>
<div id="content"><h2>Reference</h2>
<dl>
<dt id="edit_link_category"><a href="#edit_link_category">Edit a link category</a></dt>
<dd>This list display all the link categories you have defined with their
settings. When used in conjunction with the 'Delete' or 'Edit' button it
allows you to delete or edit the selected category. When editing, you can set
all the same settings as when <a href="#add_link_category">adding</a> a new
category.</dd>
<dt id="add_link_category"><a href="#add_link_category">Add a link category</a></dt>
<dd><p>Here you can create a new link category. The following settings can be
defined for your link category:</p>
<ul>
<li><strong>Name</strong>: The name of the link category.</li>
<li><strong>Auto-toggle</strong>: Check this if you want your category to
use the <a href="#auto_toggle">auto-toggle</a> feature.</li>
<li><strong>Show Images</strong>: Check this to show the images for links
in this category.</li>
<li><strong>Show Description</strong>: Check this to show the description
for links in this category.</li>
<li><strong>Show Rating</strong>: Check this to show the rating for links
in this category.</li>
<li><strong>Show Updated</strong>: Check this to show (as a tooltip) the
updated timestamp for links in this category.</li>
<li><strong>Sort Order</strong>: The order in which the links in this
category should be displayed.</li>
<li><strong>Descending</strong>: Checking this will reverese the sort
order selected (usually used for when sorted by updated or rating).</li>
<li><strong>Text/HTML before</strong>: The text or HTML to be output
before each link.</li>
<li><strong>Text/HTML between</strong>: The text or HTML to be output
before after each link or image but before the description or rating.</li>
<li><strong>Text/HTML after</strong>: The text or HTML to be output after
each link and its's description and/or rating.</li>
<li><strong>Limit</strong>: Enter a number here to limit the number of
links displayed from this category.</li>
</ul>
<p>Click on the 'Add Category!' button to add your new category.</p></dd>
<dt id="auto_toggle"><a href="#auto_toggle">Auto-toggle</a></dt>
<dd>Auto toggle is a setting for a link category. Setting this to on means
that whenever you edit links in this category, the system will only allow one
link at a time to be visible. If you set a link to be visible, or create a new
link with a visible state, the system will automatically turn off the
visibility of all the other links in that category. Some suggestions for this
functionality include a set of 'Mood' links, only one of which is 'active' at
any time; or a collection of links to CD's and set the one to which you are
currently listening to visible. All the other links will automatically be made
invisible. </dd>
</dl>
</div>
</div>
</body>
</html>

View File

@ -1,52 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>WordPress &#8212; Docs</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- fix the FOUC -->
<script type="text/javascript"> </script>
<style type="text/css">
@import url("http://wordpress.org/wp.css");
</style>
</head>
<body>
<div id="main">
<h1 id="logo"><a href="/" title="WordPress"><span>WordPress</span></a></h1>
<div id="content"><h2>Reference</h2>
<dl>
<dt id="edit_link_category"><a href="#edit_link_category">Edit a link category</a></dt>
<dd>This drop down list contains all the link categories you have defined.
When used in conjunction with the 'Delete' or 'Edit' button it allows you to
delete or edit (rename) the selected category.</dd>
<dt id="add_link_category"><a href="#add_link_category">Add a link category</a></dt>
<dd>Here you can create a new link category. There is an input box for the
name of the category. There is a checkbox for the auto-toggle state of the new
link. Type in the name, click the check box if you want this category to be
auto-toggle, then click on the 'Add it!' button.</dd>
<dt id="auto_toggle"><a href="#auto_toggle">Auto-toggle</a></dt>
<dd>Auto toggle is a setting for a link category. Setting this to on means
that whenever you edit links in this category, the system will only allow one
link at a time to be visible. If you set a link to be visible, or create a new
link with a visible state, the system will automatically turn off the
visibility of all the other links in that category. Some suggestions for this
functionality include a set of 'Mood' links, only one of which is 'active' at
any time; or a collection of links to CD's and set the one to which you are
currently listening to visible. All the other links will automatically be made
invisible. </dd>
</dl>
</div>
</div>
</body>
</html>

View File

@ -63,7 +63,45 @@ switch ($action) {
$auto_toggle = 'N';
}
$wpdb->query("INSERT INTO $tablelinkcategories (cat_id,cat_name, auto_toggle) VALUES ('0', '$cat_name', '$auto_toggle')");
$show_images = $HTTP_POST_VARS["show_images"];
if ($show_images != 'Y') {
$show_images = 'N';
}
$show_description = $HTTP_POST_VARS["show_description"];
if ($show_description != 'Y') {
$show_description = 'N';
}
$show_rating = $HTTP_POST_VARS["show_rating"];
if ($show_rating != 'Y') {
$show_rating = 'N';
}
$show_updated = $HTTP_POST_VARS["show_updated"];
if ($show_updated != 'Y') {
$show_updated = 'N';
}
$sort_order = $HTTP_POST_VARS["sort_order"];
$sort_desc = $HTTP_POST_VARS["sort_desc"];
if ($sort_desc != 'Y') {
$sort_desc = 'N';
}
$text_before_link = addslashes($HTTP_POST_VARS["text_before_link"]);
$text_after_link = addslashes($HTTP_POST_VARS["text_after_link"]);
$text_after_all = addslashes($HTTP_POST_VARS["text_after_all"]);
$list_limit = $HTTP_POST_VARS["list_limit"];
if ($list_limit == '')
$list_limit = -1;
$wpdb->query("INSERT INTO $tablelinkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .
" show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit) \n" .
" VALUES ('0', '$cat_name', '$auto_toggle', '$show_images', '$show_description', \n" .
" '$show_rating', '$show_updated', '$sort_order', '$sort_desc', '$text_before_link', '$text_after_link', \n" .
" '$text_after_all', $list_limit)");
header("Location: linkcategories.php");
break;
@ -93,24 +131,81 @@ switch ($action) {
{
include_once ("./b2header.php");
$cat_id = $HTTP_POST_VARS["cat_id"];
$cat_name=get_linkcatname($cat_id);
$cat_name=addslashes($cat_name);
$auto_toggle=get_autotoggle($cat_id);
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$cat_id");
if ($row) {
if ($row->list_limit == -1) {
$row->list_limit = '';
}
?>
<div class="wrap">
<p><b>Old</b> name: <?php echo $cat_name ?></p>
<p>Edit Link Category '<b><?php echo $row->cat_name?></b>'</p>
<p>
<form name="editcat" method="post">
<b>New</b> name:<br />
<input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_id" value="<?php echo $HTTP_POST_VARS["cat_id"] ?>" />
<input type="text" name="cat_name" value="<?php echo $cat_name ?>" /><br />
<input type="checkbox" name="auto_toggle" value="Y" <?php echo $auto_toggle == 'Y' ? '"checked"' : ''; ?>/> auto-toggle?<br />
<input type="submit" name="submit" value="Edit it !" class="search" />
<input type="hidden" name="cat_id" value="<?php echo $row->cat_id ?>" />
<table border="0">
<tr>
<td align="right">Name:</td>
<td><input type="text" name="cat_name" size="25" value="<?php echo stripslashes($row->cat_name)?>" />&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="auto_toggle" <?php echo ($row->auto_toggle == 'Y') ? 'checked' : '';?> value="Y" /> auto-toggle?</td>
</tr>
<tr>
<td align="right"><b>Show:</b></td>
<td>
<input type="checkbox" name="show_images" <?php echo ($row->show_images == 'Y') ? 'checked' : '';?> value="Y" /> images&nbsp;&nbsp;
<input type="checkbox" name="show_description" <?php echo ($row->show_description == 'Y') ? 'checked' : '';?> value="Y" /> description&nbsp;&nbsp;
<input type="checkbox" name="show_rating" <?php echo ($row->show_rating == 'Y') ? 'checked' : '';?> value="Y" /> rating&nbsp;&nbsp;
<input type="checkbox" name="show_updated" <?php echo ($row->show_updated == 'Y') ? 'checked' : '';?> value="Y" /> updated
</td>
</tr>
<tr>
<td align="right">Sort order:</td>
<td>
<select name="sort_order" size="1">
<option value="name" <?php echo ($row->sort_order == 'name') ? 'selected' : ''?>>Name</option>
<option value="id" <?php echo ($row->sort_order == 'id') ? 'selected' : ''?>>Id</option>
<option value="url" <?php echo ($row->sort_order == 'url') ? 'selected' : ''?>>URL</option>
<option value="rating" <?php echo ($row->sort_order == 'rating') ? 'selected' : ''?>>Rating</option>
<option value="updated" <?php echo ($row->sort_order == 'updated') ? 'selected' : ''?>>Updated</option>
<option value="rand" <?php echo ($row->sort_order == 'rand') ? 'selected' : ''?>>Random</option>
</select>&nbsp;&nbsp;
<input type="checkbox" name="sort_desc" <?php echo ($row->sort_desc == 'Y') ? 'checked' : '';?> value="Y" /> Descending?<br />
</td>
</tr>
<tr>
<td align="center"><b>Text/HTML</b></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">before:</td>
<td><input type="text" name="text_before_link" size="45" value="<?php echo stripslashes($row->text_before_link)?>" /></td>
</tr>
<tr>
<td align="right">between:</td>
<td><input type="text" name="text_after_link" size="45" value="<?php echo stripslashes($row->text_after_link)?>" /></td>
</tr>
<tr>
<td align="right">after:</td>
<td><input type="text" name="text_after_all" size="45" value="<?php echo stripslashes($row->text_after_all)?>" /></td>
</tr>
<tr>
<td align="right">limit:</td>
<td><input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit?>"/> (leave empty for no limit)</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="submit" value="Save" class="search" />&nbsp;
<input type="submit" name="submit" value="Cancel" class="search">
</td>
</tr>
</table>
</form>
</p>
</div>
<?php
} // end if row
break;
} // end Edit
case "editedcat":
@ -121,15 +216,71 @@ switch ($action) {
if ($user_level < $minadminlevel)
die ("Cheatin' uh ?");
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
$cat_id=$HTTP_POST_VARS["cat_id"];
$auto_toggle=$HTTP_POST_VARS["auto_toggle"];
if (isset($submit) && ($submit == "Save")) {
$cat_id=$HTTP_POST_VARS["cat_id"];
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
$auto_toggle = $HTTP_POST_VARS["auto_toggle"];
if ($auto_toggle != 'Y') {
$auto_toggle = 'N';
}
$show_images = $HTTP_POST_VARS["show_images"];
if ($show_images != 'Y') {
$show_images = 'N';
}
$show_description = $HTTP_POST_VARS["show_description"];
if ($show_description != 'Y') {
$show_description = 'N';
}
$show_rating = $HTTP_POST_VARS["show_rating"];
if ($show_rating != 'Y') {
$show_rating = 'N';
}
$show_updated = $HTTP_POST_VARS["show_updated"];
if ($show_updated != 'Y') {
$show_updated = 'N';
}
$sort_order = $HTTP_POST_VARS["sort_order"];
$sort_desc = $HTTP_POST_VARS["sort_desc"];
if ($sort_desc != 'Y') {
$sort_desc = 'N';
}
$text_before_link = addslashes($HTTP_POST_VARS["text_before_link"]);
$text_after_link = addslashes($HTTP_POST_VARS["text_after_link"]);
$text_after_all = addslashes($HTTP_POST_VARS["text_after_all"]);
$list_limit = $HTTP_POST_VARS["list_limit"];
if ($list_limit == '')
$list_limit = -1;
$wpdb->query("UPDATE $tablelinkcategories set
cat_name='$cat_name',
auto_toggle='$auto_toggle',
show_images='$show_images',
show_description='$show_description',
show_rating='$show_rating',
show_updated='$show_updated',
sort_order='$sort_order',
sort_desc='$sort_desc',
text_before_link='$text_before_link',
text_after_link='$text_after_link',
text_after_all='$text_after_all',
list_limit=$list_limit
WHERE cat_id=$cat_id
");
} // end if save
$wpdb->query("UPDATE $tablelinkcategories SET cat_name='$cat_name', auto_toggle='$auto_toggle' WHERE cat_id=$cat_id");
header("Location: linkcategories.php");
break;
} // end edit
} // end editcat
default:
{
$standalone=0;
@ -140,42 +291,127 @@ switch ($action) {
?>
<div class="wrap">
<table width="" cellpadding="5" cellspacing="0" border="0">
<tr><td><b>Link Categories:</b></td></tr>
<tr>
<td>
<form name="cats" method="post">
<b>Edit</b> a link category:<br />
<table width="" cellpadding="5" cellspacing="0" border="0">
<tr style="background-color: #ddd;">
<th rowspan="2" valign="bottom" style="border-bottom: 1px dotted #9C9A9C;" >Id</th>
<th rowspan="2" valign="bottom" style="border-bottom: 1px dotted #9C9A9C;" >Name</th>
<th rowspan="2" valign="bottom" style="border-bottom: 1px dotted #9C9A9C;" >Auto<br />Toggle?</th>
<th colspan="4" valign="bottom" style="border-left: 1px dotted #9C9A9C; border-right: 1px dotted #9C9A9C;">Show</th>
<th rowspan="2" valign="bottom" style="border-bottom: 1px dotted #9C9A9C;" >Sort Order</th>
<th rowspan="2" valign="bottom" style="border-bottom: 1px dotted #9C9A9C;" >Desc?</th>
<th colspan="3" valign="bottom" style="border-left: 1px dotted #9C9A9C; border-right: 1px dotted #9C9A9C;">Text/HTML</th>
<th rowspan="2" valign="bottom" style="border-bottom: 1px dotted #9C9A9C;" >Limit</th>
<th rowspan="2" colspan="2" style="border-bottom: 1px dotted #9C9A9C;" >&nbsp;</th>
</tr>
<tr style="background-color: #ddd;">
<th valign="top" style="border-bottom: 1px dotted #9C9A9C; border-left: 1px dotted #9C9A9C;" >images?</th>
<th valign="top" style="border-bottom: 1px dotted #9C9A9C;" >desc?</th>
<th valign="top" style="border-bottom: 1px dotted #9C9A9C;" >rating?</th>
<th valign="top" style="border-bottom: 1px dotted #9C9A9C; border-right: 1px dotted #9C9A9C;" >updated?</th>
<th valign="top" style="border-bottom: 1px dotted #9C9A9C; border-left: 1px dotted #9C9A9C;" >before</th>
<th valign="top" style="border-bottom: 1px dotted #9C9A9C;" >between</th>
<th valign="top" style="border-bottom: 1px dotted #9C9A9C; border-right: 1px dotted #9C9A9C;" >after</th>
</tr>
<form name="cats" method="post">
<input type="hidden" name="cat_id" value="" />
<input type="hidden" name="action" value="" />
<?php
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
echo " <select name=\"cat_id\">\n";
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories ORDER BY cat_id");
foreach ($results as $row) {
echo " <option value=\"".$row->cat_id."\"";
if ($row->cat_id == $cat_id)
echo ' selected';
echo ">".$row->cat_id.": ".$row->cat_name;
if ($row->auto_toggle == 'Y')
echo ' (auto toggle)';
echo "</option>\n";
}
echo " </select>\n";
if ($row->list_limit == -1) {
$row->list_limit = 'none';
}
$style = ($i % 2) ? ' class="alternate"' : '';
?>
<br /><br />
<input type="submit" name="action" value="Delete" class="search" />
<input type="submit" name="action" value="Edit" class="search" />
<tr valign="middle" <?php echo $style ?>>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->cat_id?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo stripslashes($row->cat_name)?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->auto_toggle?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->show_images?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->show_description?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->show_rating?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->show_updated?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->sort_order?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->sort_desc?></td>
<td style="border-bottom: 1px dotted #9C9A9C;" nowrap><?php echo htmlentities($row->text_before_link)?>&nbsp;</td>
<td style="border-bottom: 1px dotted #9C9A9C;" nowrap><?php echo htmlentities($row->text_after_link)?>&nbsp;</td>
<td style="border-bottom: 1px dotted #9C9A9C;" nowrap><?php echo htmlentities($row->text_after_all)?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->list_limit?></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><input type="submit" name="edit" onclick="forms['cats'].cat_id.value='<?php echo $row->cat_id?>'; forms['cats'].action.value='Edit'; " value="Edit" class="search" /></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><input type="submit" name="delete" onclick="forms['cats'].cat_id.value='<?php echo $row->cat_id?>'; forms['cats'].action.value='Delete'; return confirm('You are about to delete this category.\\n \'Cancel\' to stop, \'OK\' to delete.'); " value="Delete" class="search" /></td>
</tr>
<?php
++$i;
}
?>
</table>
</table>
</form>
</td>
<td>
<?php echo $blankline ?>
</td>
<td>
<b>Add</b> a link category:<br />
<form name="addcat" method="post">
<input type="hidden" name="action" value="addcat" />
<input type="text" name="cat_name" />&nbsp;<input type="checkbox" name="auto_toggle" value="Y" /> auto-toggle?<br /><br />
<input type="submit" name="submit" value="Add it !" class="search" />
</form>
</td>
</div>
<div class="wrap">
<form name="addcat" method="post">
<input type="hidden" name="action" value="addcat" />
<table border="0">
<tr>
<th>Add a Link Category:</th>
</tr>
<tr>
<td align="right">Name:</td>
<td><input type="text" name="cat_name" size="25" />&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="auto_toggle" value="Y" /> auto-toggle?</td>
</tr>
<tr>
<td align="right">Show:</td>
<td>
<input type="checkbox" name="show_images" value="Y" /> images&nbsp;&nbsp;
<input type="checkbox" name="show_description" value="Y" /> description&nbsp;&nbsp;
<input type="checkbox" name="show_rating" value="Y" /> rating&nbsp;&nbsp;
<input type="checkbox" name="show_updated" value="Y" /> updated</td>
</tr>
<tr>
<td align="right">Sort order:</td>
<td><select name="sort_order" size="1">
<option value="name">Name</option>
<option value="id">Id</option>
<option value="url">URL</option>
<option value="rating">Rating</option>
<option value="updated">Updated</option>
<option value="rand">Random</option>
</select>&nbsp;&nbsp;
<input type="checkbox" name="sort_desc" value="N" /> Descending?<br /></td>
</tr>
<tr>
<td align="center">Text/HTML</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">before:</td>
<td><input type="text" name="text_before_link" size="45" value="&lt;li&gt;"/></td>
</tr>
<tr>
<td align="right">between:</td>
<td><input type="text" name="text_after_link" size="45" value="&lt;br /&gt;" /></td>
</tr>
<tr>
<td align="right">after:</td>
<td><input type="text" name="text_after_all" size="45" value="&lt;/li&gt;"/></td>
</tr>
<tr>
<td align="right">limit:</td>
<td><input type="text" name="list_limit" size="5" value=""/> (leave empty for no limit)</td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name="submit" value="Add Category!" class="search" /></td>
</tr>
</form>
</table>
</div>

View File

@ -31,6 +31,7 @@ require_once('../wp-links/links.config.php');
require_once("../wp-links/links.php");
$title = 'Manage Links';
$this_file = 'linkmanager.php';
function category_dropdown($fieldname, $selected = 0) {
global $wpdb, $tablelinkcategories;
@ -90,7 +91,6 @@ $links_show_order = $HTTP_COOKIE_VARS["links_show_order"];
if ($action2 != '')
$action = $action2;
//error_log("action=$action");
switch ($action) {
case 'Assign':
{
@ -105,7 +105,7 @@ switch ($action) {
//userlevel of the owner of the link then we can proceed.
if (count($linkcheck) == 0) {
header('Location: linkmanager.php');
header('Location: '.$this_file);
exit;
}
$all_links = join(',', $linkcheck);
@ -120,7 +120,7 @@ switch ($action) {
$all_links = join(',', $ids_to_change);
$q = $wpdb->query("update $tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)");
header('Location: linkmanager.php');
header('Location: '.$this_file);
break;
}
case 'Visibility':
@ -134,7 +134,7 @@ switch ($action) {
//for each link id (in $linkcheck[]): toggle the visibility
if (count($linkcheck) == 0) {
header('Location: linkmanager.php');
header('Location: '.$this_file);
exit;
}
$all_links = join(',', $linkcheck);
@ -158,7 +158,7 @@ switch ($action) {
$q = $wpdb->query("update $tablelinks SET link_visible='Y' WHERE link_id IN ($all_linkson)");
}
header('Location: linkmanager.php');
header('Location: '.$this_file);
break;
}
case 'Move':
@ -171,14 +171,14 @@ switch ($action) {
//for each link id (in $linkcheck[]) change category to selected value
if (count($linkcheck) == 0) {
header('Location: linkmanager.php');
header('Location: '.$this_file);
exit;
}
$all_links = join(',', $linkcheck);
// should now have an array of links we can change
$q = $wpdb->query("update $tablelinks SET link_category='$category' WHERE link_id IN ($all_links)");
header('Location: linkmanager.php');
header('Location: '.$this_file);
break;
}
@ -213,7 +213,7 @@ switch ($action) {
. addslashes($link_image) . "', '$link_target', $link_category, '"
. addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) . "', '" . addslashes($link_notes) . "')");
header('Location: linkmanager.php');
header('Location: '.$this_file);
break;
} // end Add
@ -263,10 +263,9 @@ switch ($action) {
" link_rel='" . addslashes($link_rel) . "',\n" .
" link_notes='" . addslashes($link_notes) . "'\n" .
" WHERE link_id=$link_id");
//error_log($sql);
} // end if save
setcookie('links_show_cat_id', $links_show_cat_id, time()+600);
header("Location: linkmanager.php");
header('Location: '.$this_file);
break;
} // end Save
@ -291,7 +290,7 @@ switch ($action) {
}
$links_show_cat_id = $cat_id;
setcookie("links_show_cat_id", $links_show_cat_id, time()+600);
header("Location: linkmanager.php");
header('Location: '.$this_file);
break;
} // end Delete
@ -382,10 +381,10 @@ switch ($action) {
<tr height="20">
<td height="20" align="right">Visible:</td>
<td><label>
<input type="radio" name="visible" checked="checked" value="Y">
<input type="radio" name="visible" <?php if ($link_visible == 'Y') echo "checked"; ?> value="Y">
Yes</label>
&nbsp;<label>
<input type="radio" name="visible" value="N">
<input type="radio" name="visible" <?php if ($link_visible == 'N') echo "checked"; ?> value="N">
No</label>
</td>
</tr>
@ -563,10 +562,7 @@ function checkAll(form)
LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id
LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner ";
//$use_adminlevels = 0;
if (isset($cat_id) && ($cat_id != 'All')) {
// have we already started the where clause?
$sql .= " WHERE link_category = $cat_id ";
}
$sql .= ' ORDER BY link_' . $sqlorderby;
@ -736,7 +732,7 @@ LINKS;
</div>
<div class="wrap">
<p>You can drag <a href="javascript:void(linkmanpopup=window.open('<?php echo $siteurl; ?>/wp-admin/linkmanager.php?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'Link Manager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();" title="Link add bookmarklet">link this</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you're on to your links! Right now this only works on Mozilla or Netscape, but we're working on it.</p>
<p>You can drag <a href="javascript:void(linkmanpopup=window.open('<?php echo $siteurl; ?>/wp-admin/<?php echo $this_file ?>?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'Link Manager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();" title="Link add bookmarklet">link this</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you're on to your links! Right now this only works on Mozilla or Netscape, but we're working on it.</p>
</div>
<?php
break;

View File

@ -81,16 +81,126 @@ $error_count = 0;
$tablename = $tablelinks;
$ddl = "ALTER TABLE $tablelinks ADD COLUMN link_notes MEDIUMTEXT NOT NULL DEFAULT '' ";
maybe_add_column($tablename, 'link_notes', $ddl);
if (check_column($tablelinks, 'link_notes', 'mediumtext')) {
if (check_column($tablename, 'link_notes', 'mediumtext')) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN show_images enum('Y','N') NOT NULL default 'Y'";
maybe_add_column($tablename, 'show_images', $ddl);
if (check_column($tablename, 'show_images', "enum('Y','N')")) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN show_description enum('Y','N') NOT NULL default 'Y'";
maybe_add_column($tablename, 'show_description', $ddl);
if (check_column($tablename, 'show_description', "enum('Y','N')")) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN show_rating enum('Y','N') NOT NULL default 'Y'";
maybe_add_column($tablename, 'show_rating', $ddl);
if (check_column($tablename, 'show_rating', "enum('Y','N')")) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN show_updated enum('Y','N') NOT NULL default 'Y'";
maybe_add_column($tablename, 'show_updated', $ddl);
if (check_column($tablename, 'show_updated', "enum('Y','N')")) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN sort_order varchar(64) NOT NULL default 'name'";
maybe_add_column($tablename, 'sort_order', $ddl);
if (check_column($tablename, 'sort_order', "varchar(64)")) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN sort_desc enum('Y','N') NOT NULL default 'N'";
maybe_add_column($tablename, 'sort_desc', $ddl);
if (check_column($tablename, 'sort_Desc', "enum('Y','N')")) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN text_before_link varchar(128) not null default '<li>'";
maybe_add_column($tablename, 'text_before_link', $ddl);
if (check_column($tablename, 'text_before_link', 'varchar(128)')) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN text_after_link varchar(128) not null default '<br />'";
maybe_add_column($tablename, 'text_after_link', $ddl);
if (check_column($tablename, 'text_after_link', 'varchar(128)')) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN text_after_all varchar(128) not null default '</li>'";
maybe_add_column($tablename, 'text_after_all', $ddl);
if (check_column($tablename, 'text_after_all', 'varchar(128)')) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
$tablename = $tablelinkcategories;
$ddl = "ALTER TABLE $tablelinkcategories ADD COLUMN list_limit int not null default -1";
maybe_add_column($tablename, 'list_limit', $ddl);
if (check_column($tablename, 'list_limit', 'int(11)')) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
if ($error_count > 0) {
?>
<p>Hmmm... there was some kind of error. If you cannot figure out
see from the output above how to correct the problems please
visit our <a href="http://wordpress.org/support/">support
forums</a> and report your problem.</p>
<?php
} else {
?>
<p>OK, that wasn't too bad was it? Let's move on to <a href="<?php echo $thisfile;?>?step=2">step 2</a>!</p>
<?php
}
break;
case 2:
?>
<h1>Step 2</h1>
@ -104,7 +214,7 @@ CREATE TABLE $tableoptions (
option_id int(11) NOT NULL auto_increment,
blog_id int(11) NOT NULL default 0,
option_name varchar(64) NOT NULL default '',
option_can_override enum ('Y','N') NOT NULL default 'Y',
option_can_override enum('Y','N') NOT NULL default 'Y',
option_type int(11) NOT NULL default 1,
option_value varchar(255) NOT NULL default '',
option_width int NOT NULL default 20,

View File

@ -95,10 +95,10 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
$results = $wpdb->get_results("DESC $table_name");
foreach ($results as $row ) {
print_r($row);
//print_r($row);
if ($row->Field == $col_name) {
// got our column, check the params
echo ("checking $row->Type != $col_type\n");
//echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs;
}
@ -114,8 +114,10 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
if (($extra != null) && ($row->Extra != $extra)) {
++$diffs;
}
if ($diffs > 0)
if ($diffs > 0) {
//echo ("diffs = $diffs returning false\n");
return false;
}
return true;
} // end if found our column
}

View File

@ -89,6 +89,16 @@ if (!$got_cats) {
" cat_id int(11) NOT NULL auto_increment, " .
" cat_name tinytext NOT NULL, ".
" auto_toggle enum ('Y','N') NOT NULL default 'N', ".
" show_images enum ('Y','N') NOT NULL default 'Y', " .
" show_description enum ('Y','N') NOT NULL default 'Y', " .
" show_rating enum ('Y','N') NOT NULL default 'Y', " .
" show_updated enum ('Y','N') NOT NULL default 'Y', " .
" sort_order varchar(64) NOT NULL default 'name', " .
" sort_desc enum('Y','N') NOT NULL default 'N', " .
" text_before_link varchar(128) not null default '<li>', " .
" text_after_link varchar(128) not null default '<br />'," .
" text_after_all varchar(128) not null default '</li>', " .
" list_limit int not null default -1, " .
" PRIMARY KEY (cat_id) ".
") ";
$result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());