mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-05 07:58:35 +01:00
Redid HTML, cleaned up interface, ezSQL, order by name by default.
git-svn-id: http://svn.automattic.com/wordpress/trunk@130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
faeb3b3cf8
commit
a4ba40f8f1
@ -339,7 +339,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
$links_show_cat_id = $cat_id;
|
$links_show_cat_id = $cat_id;
|
||||||
if (!isset($order_by) || ($order_by == ''))
|
if (!isset($order_by) || ($order_by == ''))
|
||||||
$order_by = 'order_id';
|
$order_by = 'order_name';
|
||||||
setcookie('links_show_cat_id', $links_show_cat_id, time()+600);
|
setcookie('links_show_cat_id', $links_show_cat_id, time()+600);
|
||||||
$standalone=0;
|
$standalone=0;
|
||||||
include_once ("./b2header.php");
|
include_once ("./b2header.php");
|
||||||
@ -349,13 +349,13 @@ switch ($action) {
|
|||||||
|
|
||||||
switch ($order_by)
|
switch ($order_by)
|
||||||
{
|
{
|
||||||
case 'order_name': $sqlorderby = 'name'; break;
|
case 'order_id': $sqlorderby = 'id'; break;
|
||||||
case 'order_url': $sqlorderby = 'url'; break;
|
case 'order_url': $sqlorderby = 'url'; break;
|
||||||
case 'order_desc': $sqlorderby = 'description'; break;
|
case 'order_desc': $sqlorderby = 'description'; break;
|
||||||
case 'order_owner': $sqlorderby = 'owner'; break;
|
case 'order_owner': $sqlorderby = 'owner'; break;
|
||||||
case 'order_rating': $sqlorderby = 'rating'; break;
|
case 'order_rating': $sqlorderby = 'rating'; break;
|
||||||
case 'order_id': //fall through
|
case 'order_name':
|
||||||
default: $sqlorderby = 'id'; break;
|
default: $sqlorderby = 'name'; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action != "popup") {
|
if ($action != "popup") {
|
||||||
@ -416,25 +416,24 @@ switch ($action) {
|
|||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
|
|
||||||
<table width="100%" cellpadding="1" cellspacing="0" border="0">
|
|
||||||
<form name="links" id="links" method="post">
|
<form name="links" id="links" method="post">
|
||||||
<input type="hidden" name="link_id" value="" />
|
<input type="hidden" name="link_id" value="" />
|
||||||
<input type="hidden" name="action" value="" />
|
<input type="hidden" name="action" value="" />
|
||||||
<input type="hidden" name="order_by" value="<?php echo $order_by ?>" />
|
<input type="hidden" name="order_by" value="<?php echo $order_by ?>" />
|
||||||
<input type="hidden" name="cat_id" value="<?php echo $cat_id ?>" />
|
<input type="hidden" name="cat_id" value="<?php echo $cat_id ?>" />
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="5">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"><b>URL</b></td>
|
<th width="15%">Name</th>
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Name</b></td>
|
<th>URL</th>
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Img?</b></td>
|
<th>Category</th>
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Vis?</b></td>
|
<th>Relevance</th>
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Category</b></td>
|
<th>Image</th>
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"> </td>
|
<th>Visible</th>
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"> </td>
|
<th> </th>
|
||||||
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$sql = "SELECT link_url, link_name, link_image, link_description, link_visible, link_category AS cat_id, cat_name AS category, $tableusers.user_login, link_id, link_rating, link_rel "
|
$sql = "SELECT link_url, link_name, link_image, link_description, link_visible, link_category AS cat_id, cat_name AS category, $tableusers.user_login, link_id, link_rating, link_rel FROM $tablelinks LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id LEFT JOIN $tableusers on $tableusers.ID = $tablelinks.link_owner ";
|
||||||
. " FROM $tablelinks LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id "
|
|
||||||
. " LEFT JOIN $tableusers on $tableusers.ID = $tablelinks.link_owner ";
|
|
||||||
// have we got a where clause?
|
// have we got a where clause?
|
||||||
if (($use_adminlevels) || (isset($cat_id) && ($cat_id != 'All')) ) {
|
if (($use_adminlevels) || (isset($cat_id) && ($cat_id != 'All')) ) {
|
||||||
$sql .= " WHERE ";
|
$sql .= " WHERE ";
|
||||||
@ -450,49 +449,40 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
$sql .= " link_category = $cat_id ";
|
$sql .= " link_category = $cat_id ";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY link_".$sqlorderby;
|
$sql .= ' ORDER BY link_' . $sqlorderby;
|
||||||
|
|
||||||
// echo "$sql";
|
// echo "$sql";
|
||||||
$result = mysql_query($sql) or die("Couldn't execute query.".mysql_error());
|
$links = $wpdb->get_results($sql);
|
||||||
while ($row = mysql_fetch_object($result)) {
|
foreach ($links as $link) {
|
||||||
$short_url = str_replace('http://', '', $row->link_url);
|
$short_url = str_replace('http://', '', $link->link_url);
|
||||||
if (strlen($short_url) > 35) {
|
$short_url = str_replace('www.', '', $short_url);
|
||||||
$short_url = substr($short_url, 0, 32).'...';
|
if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1);
|
||||||
}
|
if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...';
|
||||||
echo("<tr>\n");
|
|
||||||
echo(" <td ><a href=\"".$row->link_url."\">".$short_url."</a></td>\n");
|
|
||||||
echo(" <td >".stripslashes($row->link_name)."</td>\n");
|
|
||||||
if ($row->link_image != null) {
|
|
||||||
echo(" <td align=\"center\">Y</td>\n");
|
|
||||||
} else {
|
|
||||||
echo(" <td align=\"center\">N</td>\n");
|
|
||||||
}
|
|
||||||
if ($row->link_visible == 'Y') {
|
|
||||||
echo(" <td align=\"center\">Y</td>\n");
|
|
||||||
} else {
|
|
||||||
echo(" <td align=\"center\">N</td>\n");
|
|
||||||
}
|
|
||||||
echo(" <td>".stripslashes($row->category)."</td>\n");
|
|
||||||
echo(" <td><input type=\"submit\" name=\"edit\" onclick=\"document.forms['links'].link_id.value='$row->link_id'; document.forms['links'].action.value='linkedit'; \" value=\"Edit\" class=\"search\" /></td>\n");
|
|
||||||
echo(" <td><input type=\"submit\" name=\"delete\" onclick=\"document.forms['links'].link_id.value='$row->link_id'; document.forms['links'].action.value='Delete'; return confirm('You are about to delete this link.\\n \'Cancel\' to stop, \'OK\' to delete.'); \" value=\"Delete\" class=\"search\" /></td>\n");
|
|
||||||
echo("</tr>\n");
|
|
||||||
|
|
||||||
echo("<tr>\n");
|
$link->link_name = stripslashes($link->link_name);
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" colspan=\"2\"><b>Desc:</b> ".stripslashes($row->link_description)."</td>\n");
|
$link->category = stripslashes($link->category);
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rel:</b></td>\n");
|
$link->link_rel = stripslashes($link->link_rel);
|
||||||
$my_rel = stripslashes($row->link_rel);
|
$image = ($link->link_image != null) ? 'Yes' : 'No';
|
||||||
if ($my_rel == '') {
|
$visible = ($link->link_visible == 'Y') ? 'Yes' : 'No';
|
||||||
$my_rel = ' ';
|
++$i;
|
||||||
}
|
$style = ($i % 2) ? ' class="alternate"' : '';
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" >$my_rel</td>\n");
|
echo <<<LINKS
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rating:</b> ".$row->link_rating."</td>\n");
|
<tr valign="middle"$style>
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\"><b>Owner:</b></td>\n");
|
<td><strong>$link->link_name</strong><br />
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\">".$row->user_login."</td>\n");
|
Description: $link->link_description</td>
|
||||||
echo("</tr>\n");
|
<td><a href="$link->link_url" title="Visit $link->link_name">$short_url</a></td>
|
||||||
|
<td>$link->category</td>
|
||||||
|
<td>$link->link_rel</td>
|
||||||
|
<td>$image</td>
|
||||||
|
<td>$visible</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>
|
||||||
|
<td><input type="submit" name="delete" onclick="document.forms['links'].link_id.value='$link->link_id'; document.forms['links'].action.value='Delete'; return confirm('You are about to delete this link.\\n \'Cancel\' to stop, \'OK\' to delete.'); " value="Delete" class="search" /></td>
|
||||||
|
</tr>
|
||||||
|
LINKS;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</form>
|
|
||||||
</table>
|
</table>
|
||||||
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} // end if !popup
|
} // end if !popup
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user