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:
parent
eabfb997e3
commit
ce9a4162bc
|
@ -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 — 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>
|
|
@ -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 — 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>
|
|
|
@ -56,15 +56,53 @@ switch ($action) {
|
||||||
|
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
die ("Cheatin' uh ?");
|
die ("Cheatin' uh ?");
|
||||||
|
|
||||||
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
|
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
|
||||||
$auto_toggle = $HTTP_POST_VARS["auto_toggle"];
|
$auto_toggle = $HTTP_POST_VARS["auto_toggle"];
|
||||||
if ($auto_toggle != 'Y') {
|
if ($auto_toggle != 'Y') {
|
||||||
$auto_toggle = 'N';
|
$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");
|
header("Location: linkcategories.php");
|
||||||
break;
|
break;
|
||||||
} // end addcat
|
} // end addcat
|
||||||
|
@ -82,7 +120,7 @@ switch ($action) {
|
||||||
|
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
die ("Cheatin' uh ?");
|
die ("Cheatin' uh ?");
|
||||||
|
|
||||||
$wpdb->query("DELETE FROM $tablelinkcategories WHERE cat_id='$cat_id'");
|
$wpdb->query("DELETE FROM $tablelinkcategories WHERE cat_id='$cat_id'");
|
||||||
$wpdb->query("UPDATE $tablelinks SET link_category=1 WHERE link_category='$cat_id'");
|
$wpdb->query("UPDATE $tablelinks SET link_category=1 WHERE link_category='$cat_id'");
|
||||||
|
|
||||||
|
@ -93,24 +131,81 @@ switch ($action) {
|
||||||
{
|
{
|
||||||
include_once ("./b2header.php");
|
include_once ("./b2header.php");
|
||||||
$cat_id = $HTTP_POST_VARS["cat_id"];
|
$cat_id = $HTTP_POST_VARS["cat_id"];
|
||||||
$cat_name=get_linkcatname($cat_id);
|
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||||
$cat_name=addslashes($cat_name);
|
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||||
$auto_toggle=get_autotoggle($cat_id);
|
. " 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">
|
<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>
|
<p>
|
||||||
<form name="editcat" method="post">
|
<form name="editcat" method="post">
|
||||||
<b>New</b> name:<br />
|
|
||||||
<input type="hidden" name="action" value="editedcat" />
|
<input type="hidden" name="action" value="editedcat" />
|
||||||
<input type="hidden" name="cat_id" value="<?php echo $HTTP_POST_VARS["cat_id"] ?>" />
|
<input type="hidden" name="cat_id" value="<?php echo $row->cat_id ?>" />
|
||||||
<input type="text" name="cat_name" value="<?php echo $cat_name ?>" /><br />
|
<table border="0">
|
||||||
<input type="checkbox" name="auto_toggle" value="Y" <?php echo $auto_toggle == 'Y' ? '"checked"' : ''; ?>/> auto-toggle?<br />
|
<tr>
|
||||||
<input type="submit" name="submit" value="Edit it !" class="search" />
|
<td align="right">Name:</td>
|
||||||
|
<td><input type="text" name="cat_name" size="25" value="<?php echo stripslashes($row->cat_name)?>" />
|
||||||
|
<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
|
||||||
|
<input type="checkbox" name="show_description" <?php echo ($row->show_description == 'Y') ? 'checked' : '';?> value="Y" /> description
|
||||||
|
<input type="checkbox" name="show_rating" <?php echo ($row->show_rating == 'Y') ? 'checked' : '';?> value="Y" /> rating
|
||||||
|
<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>
|
||||||
|
<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> </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" />
|
||||||
|
<input type="submit" name="submit" value="Cancel" class="search">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
} // end if row
|
||||||
break;
|
break;
|
||||||
} // end Edit
|
} // end Edit
|
||||||
case "editedcat":
|
case "editedcat":
|
||||||
|
@ -120,16 +215,72 @@ switch ($action) {
|
||||||
|
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
die ("Cheatin' uh ?");
|
die ("Cheatin' uh ?");
|
||||||
|
|
||||||
|
if (isset($submit) && ($submit == "Save")) {
|
||||||
|
|
||||||
|
$cat_id=$HTTP_POST_VARS["cat_id"];
|
||||||
|
|
||||||
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
|
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
|
||||||
$cat_id=$HTTP_POST_VARS["cat_id"];
|
$auto_toggle = $HTTP_POST_VARS["auto_toggle"];
|
||||||
$auto_toggle=$HTTP_POST_VARS["auto_toggle"];
|
if ($auto_toggle != 'Y') {
|
||||||
|
$auto_toggle = 'N';
|
||||||
|
}
|
||||||
|
|
||||||
$wpdb->query("UPDATE $tablelinkcategories SET cat_name='$cat_name', auto_toggle='$auto_toggle' WHERE cat_id=$cat_id");
|
$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
|
||||||
|
|
||||||
|
|
||||||
header("Location: linkcategories.php");
|
header("Location: linkcategories.php");
|
||||||
break;
|
break;
|
||||||
} // end edit
|
} // end editcat
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
$standalone=0;
|
$standalone=0;
|
||||||
|
@ -140,42 +291,127 @@ switch ($action) {
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<table width="" cellpadding="5" cellspacing="0" border="0">
|
<table width="" cellpadding="5" cellspacing="0" border="0">
|
||||||
<tr><td><b>Link Categories:</b></td></tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<form name="cats" method="post">
|
<form name="cats" method="post">
|
||||||
<b>Edit</b> a link category:<br />
|
<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;" > </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
|
<?php
|
||||||
$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, show_images, show_description, "
|
||||||
echo " <select name=\"cat_id\">\n";
|
. " 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) {
|
foreach ($results as $row) {
|
||||||
echo " <option value=\"".$row->cat_id."\"";
|
if ($row->list_limit == -1) {
|
||||||
if ($row->cat_id == $cat_id)
|
$row->list_limit = 'none';
|
||||||
echo ' selected';
|
}
|
||||||
echo ">".$row->cat_id.": ".$row->cat_name;
|
$style = ($i % 2) ? ' class="alternate"' : '';
|
||||||
if ($row->auto_toggle == 'Y')
|
|
||||||
echo ' (auto toggle)';
|
|
||||||
echo "</option>\n";
|
|
||||||
}
|
|
||||||
echo " </select>\n";
|
|
||||||
?>
|
?>
|
||||||
<br /><br />
|
<tr valign="middle" <?php echo $style ?>>
|
||||||
<input type="submit" name="action" value="Delete" class="search" />
|
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->cat_id?></td>
|
||||||
<input type="submit" name="action" value="Edit" class="search" />
|
<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)?> </td>
|
||||||
|
<td style="border-bottom: 1px dotted #9C9A9C;" nowrap><?php echo htmlentities($row->text_after_link)?> </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>
|
</form>
|
||||||
</td>
|
</div>
|
||||||
<td>
|
|
||||||
<?php echo $blankline ?>
|
<div class="wrap">
|
||||||
</td>
|
<form name="addcat" method="post">
|
||||||
<td>
|
<input type="hidden" name="action" value="addcat" />
|
||||||
<b>Add</b> a link category:<br />
|
<table border="0">
|
||||||
<form name="addcat" method="post">
|
<tr>
|
||||||
<input type="hidden" name="action" value="addcat" />
|
<th>Add a Link Category:</th>
|
||||||
<input type="text" name="cat_name" /> <input type="checkbox" name="auto_toggle" value="Y" /> auto-toggle?<br /><br />
|
|
||||||
<input type="submit" name="submit" value="Add it !" class="search" />
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">Name:</td>
|
||||||
|
<td><input type="text" name="cat_name" size="25" />
|
||||||
|
<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
|
||||||
|
<input type="checkbox" name="show_description" value="Y" /> description
|
||||||
|
<input type="checkbox" name="show_rating" value="Y" /> rating
|
||||||
|
<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>
|
||||||
|
<input type="checkbox" name="sort_desc" value="N" /> Descending?<br /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center">Text/HTML</td>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">before:</td>
|
||||||
|
<td><input type="text" name="text_before_link" size="45" value="<li>"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">between:</td>
|
||||||
|
<td><input type="text" name="text_after_link" size="45" value="<br />" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">after:</td>
|
||||||
|
<td><input type="text" name="text_after_all" size="45" value="</li>"/></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>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,10 +31,11 @@ require_once('../wp-links/links.config.php');
|
||||||
require_once("../wp-links/links.php");
|
require_once("../wp-links/links.php");
|
||||||
|
|
||||||
$title = 'Manage Links';
|
$title = 'Manage Links';
|
||||||
|
$this_file = 'linkmanager.php';
|
||||||
|
|
||||||
function category_dropdown($fieldname, $selected = 0) {
|
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 ' <select name="'.$fieldname.'" size="1">'."\n";
|
||||||
foreach ($results as $row) {
|
foreach ($results as $row) {
|
||||||
|
@ -90,22 +91,21 @@ $links_show_order = $HTTP_COOKIE_VARS["links_show_order"];
|
||||||
if ($action2 != '')
|
if ($action2 != '')
|
||||||
$action = $action2;
|
$action = $action2;
|
||||||
|
|
||||||
//error_log("action=$action");
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'Assign':
|
case 'Assign':
|
||||||
{
|
{
|
||||||
$standalone = 1;
|
$standalone = 1;
|
||||||
include_once('b2header.php');
|
include_once('b2header.php');
|
||||||
|
|
||||||
// check the current user's level first.
|
// check the current user's level first.
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
die ("Cheatin' uh ?");
|
die ("Cheatin' uh ?");
|
||||||
|
|
||||||
//for each link id (in $linkcheck[]): if the current user level >= the
|
//for each link id (in $linkcheck[]): if the current user level >= the
|
||||||
//userlevel of the owner of the link then we can proceed.
|
//userlevel of the owner of the link then we can proceed.
|
||||||
|
|
||||||
if (count($linkcheck) == 0) {
|
if (count($linkcheck) == 0) {
|
||||||
header('Location: linkmanager.php');
|
header('Location: '.$this_file);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$all_links = join(',', $linkcheck);
|
$all_links = join(',', $linkcheck);
|
||||||
|
@ -120,21 +120,21 @@ switch ($action) {
|
||||||
$all_links = join(',', $ids_to_change);
|
$all_links = join(',', $ids_to_change);
|
||||||
$q = $wpdb->query("update $tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)");
|
$q = $wpdb->query("update $tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)");
|
||||||
|
|
||||||
header('Location: linkmanager.php');
|
header('Location: '.$this_file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'Visibility':
|
case 'Visibility':
|
||||||
{
|
{
|
||||||
$standalone = 1;
|
$standalone = 1;
|
||||||
include_once('b2header.php');
|
include_once('b2header.php');
|
||||||
|
|
||||||
// check the current user's level first.
|
// check the current user's level first.
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
die ("Cheatin' uh ?");
|
die ("Cheatin' uh ?");
|
||||||
|
|
||||||
//for each link id (in $linkcheck[]): toggle the visibility
|
//for each link id (in $linkcheck[]): toggle the visibility
|
||||||
if (count($linkcheck) == 0) {
|
if (count($linkcheck) == 0) {
|
||||||
header('Location: linkmanager.php');
|
header('Location: '.$this_file);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$all_links = join(',', $linkcheck);
|
$all_links = join(',', $linkcheck);
|
||||||
|
@ -152,13 +152,13 @@ switch ($action) {
|
||||||
$all_linksoff = join(',', $ids_to_turnoff);
|
$all_linksoff = join(',', $ids_to_turnoff);
|
||||||
$q = $wpdb->query("update $tablelinks SET link_visible='N' WHERE link_id IN ($all_linksoff)");
|
$q = $wpdb->query("update $tablelinks SET link_visible='N' WHERE link_id IN ($all_linksoff)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($ids_to_turnon)) {
|
if (count($ids_to_turnon)) {
|
||||||
$all_linkson = join(',', $ids_to_turnon);
|
$all_linkson = join(',', $ids_to_turnon);
|
||||||
$q = $wpdb->query("update $tablelinks SET link_visible='Y' WHERE link_id IN ($all_linkson)");
|
$q = $wpdb->query("update $tablelinks SET link_visible='Y' WHERE link_id IN ($all_linkson)");
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: linkmanager.php');
|
header('Location: '.$this_file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'Move':
|
case 'Move':
|
||||||
|
@ -168,17 +168,17 @@ switch ($action) {
|
||||||
// check the current user's level first.
|
// check the current user's level first.
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
die ("Cheatin' uh ?");
|
die ("Cheatin' uh ?");
|
||||||
|
|
||||||
//for each link id (in $linkcheck[]) change category to selected value
|
//for each link id (in $linkcheck[]) change category to selected value
|
||||||
if (count($linkcheck) == 0) {
|
if (count($linkcheck) == 0) {
|
||||||
header('Location: linkmanager.php');
|
header('Location: '.$this_file);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$all_links = join(',', $linkcheck);
|
$all_links = join(',', $linkcheck);
|
||||||
// should now have an array of links we can change
|
// 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)");
|
$q = $wpdb->query("update $tablelinks SET link_category='$category' WHERE link_id IN ($all_links)");
|
||||||
|
|
||||||
header('Location: linkmanager.php');
|
header('Location: '.$this_file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ switch ($action) {
|
||||||
. addslashes($link_image) . "', '$link_target', $link_category, '"
|
. addslashes($link_image) . "', '$link_target', $link_category, '"
|
||||||
. addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) . "', '" . addslashes($link_notes) . "')");
|
. addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) . "', '" . addslashes($link_notes) . "')");
|
||||||
|
|
||||||
header('Location: linkmanager.php');
|
header('Location: '.$this_file);
|
||||||
break;
|
break;
|
||||||
} // end Add
|
} // end Add
|
||||||
|
|
||||||
|
@ -263,10 +263,9 @@ switch ($action) {
|
||||||
" link_rel='" . addslashes($link_rel) . "',\n" .
|
" link_rel='" . addslashes($link_rel) . "',\n" .
|
||||||
" link_notes='" . addslashes($link_notes) . "'\n" .
|
" link_notes='" . addslashes($link_notes) . "'\n" .
|
||||||
" WHERE link_id=$link_id");
|
" WHERE link_id=$link_id");
|
||||||
//error_log($sql);
|
|
||||||
} // end if save
|
} // end if save
|
||||||
setcookie('links_show_cat_id', $links_show_cat_id, time()+600);
|
setcookie('links_show_cat_id', $links_show_cat_id, time()+600);
|
||||||
header("Location: linkmanager.php");
|
header('Location: '.$this_file);
|
||||||
break;
|
break;
|
||||||
} // end Save
|
} // end Save
|
||||||
|
|
||||||
|
@ -291,7 +290,7 @@ switch ($action) {
|
||||||
}
|
}
|
||||||
$links_show_cat_id = $cat_id;
|
$links_show_cat_id = $cat_id;
|
||||||
setcookie("links_show_cat_id", $links_show_cat_id, time()+600);
|
setcookie("links_show_cat_id", $links_show_cat_id, time()+600);
|
||||||
header("Location: linkmanager.php");
|
header('Location: '.$this_file);
|
||||||
break;
|
break;
|
||||||
} // end Delete
|
} // end Delete
|
||||||
|
|
||||||
|
@ -382,10 +381,10 @@ switch ($action) {
|
||||||
<tr height="20">
|
<tr height="20">
|
||||||
<td height="20" align="right">Visible:</td>
|
<td height="20" align="right">Visible:</td>
|
||||||
<td><label>
|
<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>
|
Yes</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="visible" value="N">
|
<input type="radio" name="visible" <?php if ($link_visible == 'N') echo "checked"; ?> value="N">
|
||||||
No</label>
|
No</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -465,7 +464,7 @@ switch ($action) {
|
||||||
if ($action != "popup") {
|
if ($action != "popup") {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
function checkAll(form)
|
function checkAll(form)
|
||||||
{
|
{
|
||||||
for (i = 0, n = form.elements.length; i < n; i++) {
|
for (i = 0, n = form.elements.length; i < n; i++) {
|
||||||
|
@ -478,7 +477,7 @@ function checkAll(form)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<form name="cats" method="post">
|
<form name="cats" method="post">
|
||||||
|
@ -563,10 +562,7 @@ function checkAll(form)
|
||||||
LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id
|
LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id
|
||||||
LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner ";
|
LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner ";
|
||||||
|
|
||||||
//$use_adminlevels = 0;
|
|
||||||
|
|
||||||
if (isset($cat_id) && ($cat_id != 'All')) {
|
if (isset($cat_id) && ($cat_id != 'All')) {
|
||||||
// have we already started the where clause?
|
|
||||||
$sql .= " WHERE link_category = $cat_id ";
|
$sql .= " WHERE link_category = $cat_id ";
|
||||||
}
|
}
|
||||||
$sql .= ' ORDER BY link_' . $sqlorderby;
|
$sql .= ' ORDER BY link_' . $sqlorderby;
|
||||||
|
@ -601,11 +597,11 @@ function checkAll(form)
|
||||||
<td>$visible</td>
|
<td>$visible</td>
|
||||||
LINKS;
|
LINKS;
|
||||||
$show_buttons = 1; // default
|
$show_buttons = 1; // default
|
||||||
|
|
||||||
if ($use_adminlevels && ($link->user_level > $user_level)) {
|
if ($use_adminlevels && ($link->user_level > $user_level)) {
|
||||||
$show_buttons = 0;
|
$show_buttons = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_buttons) {
|
if ($show_buttons) {
|
||||||
echo <<<LINKS
|
echo <<<LINKS
|
||||||
<td><input type="submit" name="edit" onclick="document.forms['links'].link_id.value='$link->link_id'; document.forms['links'].action.value='linkedit';" value="Edit" class="search" /></td>
|
<td><input type="submit" name="edit" onclick="document.forms['links'].link_id.value='$link->link_id'; document.forms['links'].action.value='linkedit';" value="Edit" class="search" /></td>
|
||||||
|
@ -736,7 +732,7 @@ LINKS;
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wrap">
|
<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>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -81,16 +81,126 @@ $error_count = 0;
|
||||||
$tablename = $tablelinks;
|
$tablename = $tablelinks;
|
||||||
$ddl = "ALTER TABLE $tablelinks ADD COLUMN link_notes MEDIUMTEXT NOT NULL DEFAULT '' ";
|
$ddl = "ALTER TABLE $tablelinks ADD COLUMN link_notes MEDIUMTEXT NOT NULL DEFAULT '' ";
|
||||||
maybe_add_column($tablename, 'link_notes', $ddl);
|
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 />';
|
$res .= $tablename . ' - ok <br />';
|
||||||
} else {
|
} else {
|
||||||
$res .= 'There was a problem with ' . $tablename . '<br />';
|
$res .= 'There was a problem with ' . $tablename . '<br />';
|
||||||
++$error_count;
|
++$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>
|
<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
|
<?php
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
?>
|
?>
|
||||||
<h1>Step 2</h1>
|
<h1>Step 2</h1>
|
||||||
|
@ -104,7 +214,7 @@ CREATE TABLE $tableoptions (
|
||||||
option_id int(11) NOT NULL auto_increment,
|
option_id int(11) NOT NULL auto_increment,
|
||||||
blog_id int(11) NOT NULL default 0,
|
blog_id int(11) NOT NULL default 0,
|
||||||
option_name varchar(64) NOT NULL default '',
|
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_type int(11) NOT NULL default 1,
|
||||||
option_value varchar(255) NOT NULL default '',
|
option_value varchar(255) NOT NULL default '',
|
||||||
option_width int NOT NULL default 20,
|
option_width int NOT NULL default 20,
|
||||||
|
|
|
@ -95,10 +95,10 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
|
||||||
$results = $wpdb->get_results("DESC $table_name");
|
$results = $wpdb->get_results("DESC $table_name");
|
||||||
|
|
||||||
foreach ($results as $row ) {
|
foreach ($results as $row ) {
|
||||||
print_r($row);
|
//print_r($row);
|
||||||
if ($row->Field == $col_name) {
|
if ($row->Field == $col_name) {
|
||||||
// got our column, check the params
|
// 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)) {
|
if (($col_type != null) && ($row->Type != $col_type)) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,10 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
|
||||||
if (($extra != null) && ($row->Extra != $extra)) {
|
if (($extra != null) && ($row->Extra != $extra)) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if ($diffs > 0)
|
if ($diffs > 0) {
|
||||||
|
//echo ("diffs = $diffs returning false\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} // end if found our column
|
} // end if found our column
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,16 @@ if (!$got_cats) {
|
||||||
" cat_id int(11) NOT NULL auto_increment, " .
|
" cat_id int(11) NOT NULL auto_increment, " .
|
||||||
" cat_name tinytext NOT NULL, ".
|
" cat_name tinytext NOT NULL, ".
|
||||||
" auto_toggle enum ('Y','N') NOT NULL default 'N', ".
|
" 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) ".
|
" PRIMARY KEY (cat_id) ".
|
||||||
") ";
|
") ";
|
||||||
$result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
|
$result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
|
||||||
|
|
Loading…
Reference in New Issue