Added in rel attribute
git-svn-id: http://svn.automattic.com/wordpress/trunk@23 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5d90dc83f4
commit
f829c1048e
|
@ -51,7 +51,7 @@ if (!get_magic_quotes_gpc()) {
|
||||||
|
|
||||||
$b2varstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image',
|
$b2varstoreset = 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');
|
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel');
|
||||||
for ($i=0; $i<count($b2varstoreset); $i += 1) {
|
for ($i=0; $i<count($b2varstoreset); $i += 1) {
|
||||||
$b2var = $b2varstoreset[$i];
|
$b2var = $b2varstoreset[$i];
|
||||||
if (!isset($$b2var)) {
|
if (!isset($$b2var)) {
|
||||||
|
@ -85,6 +85,7 @@ switch ($action) {
|
||||||
$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"];
|
||||||
$auto_toggle = get_autotoggle($link_category);
|
$auto_toggle = get_autotoggle($link_category);
|
||||||
|
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
|
@ -97,11 +98,11 @@ switch ($action) {
|
||||||
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
|
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO $tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating) " .
|
$sql = "INSERT INTO $tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel) " .
|
||||||
" VALUES('" . addslashes($link_url) . "','"
|
" VALUES('" . addslashes($link_url) . "','"
|
||||||
. addslashes($link_name) . "', '"
|
. addslashes($link_name) . "', '"
|
||||||
. 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_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) ."')";
|
||||||
|
|
||||||
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
|
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
|
||||||
|
|
||||||
|
@ -134,6 +135,7 @@ switch ($action) {
|
||||||
$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"];
|
||||||
$auto_toggle = get_autotoggle($link_category);
|
$auto_toggle = get_autotoggle($link_category);
|
||||||
|
|
||||||
if ($user_level < $minadminlevel)
|
if ($user_level < $minadminlevel)
|
||||||
|
@ -150,7 +152,8 @@ switch ($action) {
|
||||||
" link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "',\n " .
|
" link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "',\n " .
|
||||||
" link_target='$link_target',\n link_category=$link_category,\n " .
|
" link_target='$link_target',\n link_category=$link_category,\n " .
|
||||||
" link_visible='$link_visible',\n link_description='" . addslashes($link_description) . "',\n " .
|
" link_visible='$link_visible',\n link_description='" . addslashes($link_description) . "',\n " .
|
||||||
" link_rating=$link_rating\n" .
|
" link_rating=$link_rating,\n" .
|
||||||
|
" link_rel='" . addslashes($link_rel) . "'\n" .
|
||||||
" WHERE link_id=$link_id";
|
" WHERE link_id=$link_id";
|
||||||
//error_log($sql);
|
//error_log($sql);
|
||||||
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
|
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
|
||||||
|
@ -194,7 +197,7 @@ switch ($action) {
|
||||||
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> :)");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating " .
|
$sql = "SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel " .
|
||||||
" FROM $tablelinks " .
|
" FROM $tablelinks " .
|
||||||
" WHERE link_id = $link_id";
|
" WHERE link_id = $link_id";
|
||||||
|
|
||||||
|
@ -208,6 +211,7 @@ switch ($action) {
|
||||||
$link_description = stripslashes($row->link_description);
|
$link_description = stripslashes($row->link_description);
|
||||||
$link_visible = $row->link_visible;
|
$link_visible = $row->link_visible;
|
||||||
$link_rating = $row->link_rating;
|
$link_rating = $row->link_rating;
|
||||||
|
$link_rel = stripslashes($row->link_rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -236,6 +240,10 @@ switch ($action) {
|
||||||
<td height="20" align="right">Description:</td>
|
<td height="20" align="right">Description:</td>
|
||||||
<td><input type="text" name="description" size="80" value="<?php echo $link_description; ?>"></td>
|
<td><input type="text" name="description" size="80" value="<?php echo $link_description; ?>"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr height="20">
|
||||||
|
<td height="20" align="right">Rel:</td>
|
||||||
|
<td><input type="text" name="rel" size="80" value="<?php echo $link_rel; ?>"></td>
|
||||||
|
</tr>
|
||||||
<tr height="20">
|
<tr height="20">
|
||||||
<td height="20" align="right">Rating:</td>
|
<td height="20" align="right">Rating:</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -408,7 +416,7 @@ switch ($action) {
|
||||||
<td style="border-bottom: 1px dotted #9C9A9C;"> </td>
|
<td style="border-bottom: 1px dotted #9C9A9C;"> </td>
|
||||||
</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 "
|
$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 "
|
. " FROM $tablelinks 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 ";
|
||||||
// have we got a where clause?
|
// have we got a where clause?
|
||||||
|
@ -454,9 +462,15 @@ switch ($action) {
|
||||||
echo("</tr>\n");
|
echo("</tr>\n");
|
||||||
|
|
||||||
echo("<tr>\n");
|
echo("<tr>\n");
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" colspan=\"4\"><b>Desc:</b> ".stripslashes($row->link_description)."</td>\n");
|
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" colspan=\"2\"><b>Desc:</b> ".stripslashes($row->link_description)."</td>\n");
|
||||||
|
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rel:</b></td>\n");
|
||||||
|
$my_rel = stripslashes($row->link_rel);
|
||||||
|
if ($my_rel == '') {
|
||||||
|
$my_rel = ' ';
|
||||||
|
}
|
||||||
|
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" >$my_rel</td>\n");
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rating:</b> ".$row->link_rating."</td>\n");
|
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rating:</b> ".$row->link_rating."</td>\n");
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\"><b>Owner:</ab></td>\n");
|
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\"><b>Owner:</b></td>\n");
|
||||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\">".$row->user_login."</td>\n");
|
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\">".$row->user_login."</td>\n");
|
||||||
echo("</tr>\n");
|
echo("</tr>\n");
|
||||||
}
|
}
|
||||||
|
@ -491,6 +505,10 @@ switch ($action) {
|
||||||
<td height="20" align="right">Description:</td>
|
<td height="20" align="right">Description:</td>
|
||||||
<td><input type="text" name="description" size="80" value=""></td>
|
<td><input type="text" name="description" size="80" value=""></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr height="20">
|
||||||
|
<td height="20" align="right">Rel:</td>
|
||||||
|
<td><input type="text" name="rel" size="80" value=""></td>
|
||||||
|
</tr>
|
||||||
<tr height="20">
|
<tr height="20">
|
||||||
<td height="20" align="right">Rating:</td>
|
<td height="20" align="right">Rating:</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -92,6 +92,7 @@ if (!$got_links) {
|
||||||
" link_owner int NOT NULL DEFAULT '1', " .
|
" link_owner int NOT NULL DEFAULT '1', " .
|
||||||
" link_rating int NOT NULL DEFAULT '0', " .
|
" link_rating int NOT NULL DEFAULT '0', " .
|
||||||
" link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', " .
|
" link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', " .
|
||||||
|
" link_rel varchar(255) NOT NULL default '', " .
|
||||||
" PRIMARY KEY (link_id) " .
|
" PRIMARY KEY (link_id) " .
|
||||||
") ";
|
") ";
|
||||||
$result = mysql_query($sql) or print ("Can't create the table '$tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());
|
$result = mysql_query($sql) or print ("Can't create the table '$tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());
|
||||||
|
|
|
@ -110,7 +110,7 @@ function get_links($category = -1, $before = '', $after = '<br />',
|
||||||
}
|
}
|
||||||
dbconnect();
|
dbconnect();
|
||||||
$sql = "SELECT link_url, link_name, link_image, link_target, " .
|
$sql = "SELECT link_url, link_name, link_image, link_target, " .
|
||||||
" link_description, link_rating $get_updated " .
|
" link_description, link_rating, link_rel $get_updated " .
|
||||||
" FROM $tablelinks " .
|
" FROM $tablelinks " .
|
||||||
" WHERE link_visible = 'Y' " .
|
" WHERE link_visible = 'Y' " .
|
||||||
$category_query;
|
$category_query;
|
||||||
|
@ -139,7 +139,11 @@ function get_links($category = -1, $before = '', $after = '<br />',
|
||||||
if (($row->link_url != null) || ($row->link_url != '')) {
|
if (($row->link_url != null) || ($row->link_url != '')) {
|
||||||
$the_link = $row->link_url;
|
$the_link = $row->link_url;
|
||||||
}
|
}
|
||||||
echo("<a href=\"".$the_link."\" title=\"" .
|
$rel = stripslashes($row->link_rel);
|
||||||
|
if ($rel != '') {
|
||||||
|
$rel = 'rel="'.$rel.'"';
|
||||||
|
}
|
||||||
|
echo("<a href=\"".$the_link."\" $rel title=\"" .
|
||||||
stripslashes($row->link_description) .
|
stripslashes($row->link_description) .
|
||||||
"\" target=\"$row->link_target\">");
|
"\" target=\"$row->link_target\">");
|
||||||
if (($row->link_image != null) && $show_images) {
|
if (($row->link_image != null) && $show_images) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ CREATE TABLE b2links (
|
||||||
link_owner int NOT NULL DEFAULT '1',
|
link_owner int NOT NULL DEFAULT '1',
|
||||||
link_rating int NOT NULL DEFAULT '0',
|
link_rating int NOT NULL DEFAULT '0',
|
||||||
link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
link_rel varchar(255) NOT NULL default '',
|
||||||
PRIMARY KEY (link_id)
|
PRIMARY KEY (link_id)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,6 @@
|
||||||
-- // *****************************************************************
|
-- // *****************************************************************
|
||||||
|
|
||||||
ALTER TABLE b2links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
|
ALTER TABLE b2links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
|
||||||
|
ALTER TABLE b2links ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ require_once('./b2config.php');
|
||||||
require_once($b2inc.'/b2functions.php');
|
require_once($b2inc.'/b2functions.php');
|
||||||
|
|
||||||
// globals to hold state
|
// globals to hold state
|
||||||
$inside_weblog = false;
|
|
||||||
$updated_timestamp = 0;
|
$updated_timestamp = 0;
|
||||||
$all_links = array();
|
$all_links = array();
|
||||||
|
|
||||||
|
@ -83,7 +82,7 @@ function get_weblogs_updatedfile() {
|
||||||
** Callback function. Called at the start of a new xml tag.
|
** Callback function. Called at the start of a new xml tag.
|
||||||
**/
|
**/
|
||||||
function startElement($parser, $tagName, $attrs) {
|
function startElement($parser, $tagName, $attrs) {
|
||||||
global $inside_weblog, $updated_timestamp, $all_links;
|
global $updated_timestamp, $all_links;
|
||||||
if ($tagName == 'WEBLOGUPDATES') {
|
if ($tagName == 'WEBLOGUPDATES') {
|
||||||
//convert 'updated' into php date variable
|
//convert 'updated' into php date variable
|
||||||
$updated_timestamp = strtotime($attrs['UPDATED']);
|
$updated_timestamp = strtotime($attrs['UPDATED']);
|
||||||
|
|
Loading…
Reference in New Issue