Changeset 265 for trunk/wp-admin/linkmanager.php
- Timestamp:
- 07/23/2003 12:26:03 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/linkmanager.php
r254 r265 34 34 35 35 function add_magic_quotes($array) { 36 37 38 39 40 41 42 43 44 } 36 foreach ($array as $k => $v) { 37 if (is_array($v)) { 38 $array[$k] = add_magic_quotes($v); 39 } else { 40 $array[$k] = addslashes($v); 41 } 42 } 43 return $array; 44 } 45 45 46 46 if (!get_magic_quotes_gpc()) { 47 48 49 47 $HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS); 48 $HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS); 49 $HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS); 50 50 } 51 51 52 52 $b2varstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image', 53 53 'description', 'visible', 'target', 'category', 'link_id', 54 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel' );54 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes'); 55 55 for ($i=0; $i<count($b2varstoreset); $i += 1) { 56 56 $b2var = $b2varstoreset[$i]; … … 71 71 $links_show_order = $HTTP_COOKIE_VARS["links_show_order"]; 72 72 73 // error_log("start, links_show_cat_id=$links_show_cat_id"); 73 // error_log("start, links_show_cat_id=$links_show_cat_id"); 74 74 75 75 switch ($action) { … … 88 88 $link_rating = $HTTP_POST_VARS["rating"]; 89 89 $link_rel = $HTTP_POST_VARS["rel"]; 90 $link_notes = $HTTP_POST_VARS["notes"]; 90 91 $auto_toggle = get_autotoggle($link_category); 91 92 … … 98 99 $wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category"); 99 100 } 100 101 $wpdb->query("INSERT INTO $tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel) " . 101 $wpdb->query("INSERT INTO $tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes) " . 102 102 " VALUES('" . addslashes($link_url) . "','" 103 103 . addslashes($link_name) . "', '" 104 104 . addslashes($link_image) . "', '$link_target', $link_category, '" 105 . addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) . "')");105 . addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) . "', '" . addslashes($link_notes) . "')"); 106 106 107 107 header('Location: linkmanager.php'); … … 135 135 $link_rating = $HTTP_POST_VARS["rating"]; 136 136 $link_rel = $HTTP_POST_VARS["rel"]; 137 $link_notes = $HTTP_POST_VARS["notes"]; 137 138 $auto_toggle = get_autotoggle($link_category); 138 139 … … 151 152 " link_visible='$link_visible',\n link_description='" . addslashes($link_description) . "',\n " . 152 153 " link_rating=$link_rating,\n" . 153 " link_rel='" . addslashes($link_rel) . "'\n" . 154 " link_rel='" . addslashes($link_rel) . "',\n" . 155 " link_notes='" . addslashes($link_notes) . "'\n" . 154 156 " WHERE link_id=$link_id"); 155 157 //error_log($sql); … … 174 176 if (isset($links_show_cat_id) && ($links_show_cat_id != '')) 175 177 $cat_id = $links_show_cat_id; 176 178 177 179 if (!isset($cat_id) || ($cat_id == '')) { 178 180 if (!isset($links_show_cat_id) || ($links_show_cat_id == '')) … … 184 186 break; 185 187 } // end Delete 186 188 187 189 case 'linkedit': 188 190 { … … 193 195 } 194 196 195 $row = $wpdb->get_row("SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel " .197 $row = $wpdb->get_row("SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel, link_notes " . 196 198 " FROM $tablelinks " . 197 199 " WHERE link_id = $link_id"); 198 200 199 201 if ($row) { 200 $link_url = $row->link_url;202 $link_url = stripslashes($row->link_url); 201 203 $link_name = stripslashes($row->link_name); 202 204 $link_image = $row->link_image; … … 207 209 $link_rating = $row->link_rating; 208 210 $link_rel = stripslashes($row->link_rel); 211 $link_notes = stripslashes($row->link_notes); 209 212 } 210 213 … … 212 215 213 216 <div class="wrap"> 214 215 <table width="95%" cellpadding="5" cellspacing="0" border="0"><form name="editlink" method="post"> 217 218 <table width="95%" cellpadding="5" cellspacing="0" border="0"> 219 <form name="editlink" method="post"> 216 220 <input type="hidden" name="action" value="editlink" /> 217 221 <input type="hidden" name="link_id" value="<?php echo $link_id; ?>" /> … … 221 225 <td colspan="2"><b>Edit</b> a link:</td> 222 226 </tr> 223 <tr height="20"> 227 <tr height="20"> 224 228 <td height="20" align="right">URL:</td> 225 229 <td><input type="text" name="linkurl" size="80" value="<?php echo $link_url; ?>"></td> 226 230 </tr> 227 <tr height="20"> 231 <tr height="20"> 228 232 <td height="20" align="right">Display Name/Alt text:</td> 229 233 <td><input type="text" name="name" size="80" value="<?php echo $link_name; ?>"></td> 230 234 </tr> 231 <tr height="20"> 235 <tr height="20"> 232 236 <td height="20" align="right">Image:</td> 233 237 <td><input type="text" name="image" size="80" value="<?php echo $link_image; ?>"></td> 234 238 </tr> 235 <tr height="20"> 239 <tr height="20"> 236 240 <td height="20" align="right">Description:</td> 237 241 <td><input type="text" name="description" size="80" value="<?php echo $link_description; ?>"></td> 238 242 </tr> 239 <tr height="20"> 243 <tr height="20"> 240 244 <td height="20" align="right">Rel:</td> 241 245 <td><input type="text" name="rel" size="80" value="<?php echo $link_rel; ?>"></td> 242 246 </tr> 243 <tr height="20"> 247 <tr height="20"> 248 <td height="20" valign="top" align="right">Notes:</td> 249 <td><textarea name="notes" cols="80" rows="10"><?php echo $link_notes; ?></textarea></td> 250 </tr> 251 <tr height="20"> 244 252 <td height="20" align="right">Rating:</td> 245 <td> <select name="rating" size="1"> 246 <?php 253 <td> 254 <select name="rating" size="1"> 255 <?php 247 256 for ($r = 0; $r < 10; $r++) { 248 257 echo(' <option value="'.$r.'" '); … … 252 261 } 253 262 ?> 254 </select> 255 (Leave at 0 for no rating.)</td>256 </tr> 257 <tr height="20"> 263 </select> (Leave at 0 for no rating.) 264 </td> 265 </tr> 266 <tr height="20"> 258 267 <td height="20" align="right">Target:</td> 268 <td><label><input type="radio" name="target" value="_blank" <?php echo(($link_target == '_blank') ? 'checked="checked"' : ''); ?>> _blank</label> 269 <label><input type="radio" name="target" value="_top" <?php echo(($link_target == '_top') ? 'checked="checked"' : ''); ?>> _top</label> 270 <label><input type="radio" name="target" value="" <?php echo(($link_target == '') ? 'checked="checked"' : ''); ?>> none</label> 271 </td> 272 </tr> 273 <tr height="20"> 274 <td height="20" align="right">Visible:</td> 259 275 <td><label> 260 <input type="radio" name="target" value="_blank" <?php echo(($link_target == '_blank') ? 'checked="checked"' : ''); ?>> 261 _blank</label> 262 <label> 263 <input type="radio" name="target" value="_top" <?php echo(($link_target == '_top') ? 'checked="checked"' : ''); ?>> 264 _top</label> 265 <label> 266 <input type="radio" name="target" value="" <?php echo(($link_target == '') ? 'checked="checked"' : ''); ?>> 267 none</label> 276 <input type="radio" name="visible" checked="checked" value="Y"> 277 Yes</label> 278 <label> 279 <input type="radio" name="visible" value="N"> 280 No</label> 268 281 </td> 269 282 </tr> 270 <tr height="20"> 271 <td height="20" align="right">Visible:</td> 272 <td><label> 273 <input type="radio" name="visible" checked="checked" value="Y"> 274 Y</label> <label> 275 <input type="radio" name="visible" value="N"> 276 N</label></td> 277 </tr> 278 <tr height="20"> 279 <td height="20" align="right">Category:</td> 280 <td> 281 <?php 283 <tr height="20"> 284 <td height="20" align="right"><label for="category">Category</label>:</td> 285 <td> 286 <?php 282 287 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 283 288 echo " <select name=\"category\" size=\"1\">\n"; 284 foreach ($results as $row) {289 foreach ($results as $row) { 285 290 echo " <option value=\"".$row->cat_id."\""; 286 291 if ($row->cat_id == $link_category) … … 295 300 </td> 296 301 </tr> 297 <tr height="20"> 298 <td colspan="2" align="center"> <input type="submit" name="submit" value="Save" class="search">299 300 <input type="submit" name="submit" value="Cancel" class="search"> </a>302 <tr height="20"> 303 <td colspan="2" align="center"> 304 <input type="submit" name="submit" value="Save" class="search"> 305 <input type="submit" name="submit" value="Cancel" class="search"> 301 306 </td> 302 307 </tr> … … 330 335 if (isset($links_show_cat_id) && ($links_show_cat_id != '')) 331 336 $cat_id = $links_show_cat_id; 332 337 333 338 if (!isset($cat_id) || ($cat_id == '')) { 334 339 if (!isset($links_show_cat_id) || ($links_show_cat_id == '')) … … 338 343 if (isset($links_show_order) && ($links_show_order != '')) 339 344 $order_by = $links_show_order; 340 345 341 346 if (!isset($order_by) || ($order_by == '')) 342 347 $order_by = 'order_name'; … … 358 363 case 'order_owner': $sqlorderby = 'owner'; break; 359 364 case 'order_rating': $sqlorderby = 'rating'; break; 360 365 case 'order_name': 361 366 default: $sqlorderby = 'name'; break; 362 367 } 363 368 364 369 if ($action != "popup") { 365 370 ?> … … 368 373 <form name="cats" method="post"> 369 374 <table width="75%" cellpadding="5" cellspacing="0" border="0"> 370 <tr><td><b>Link Categories:</b></td><td><a href="linkcategories.php">Manage Link Categories</a></td><td><a href="links.import.php">Import Blogroll</a></td></tr> 375 <tr> 376 <td><b>Link Categories:</b></td> 377 <td><a href="linkcategories.php">Manage Link Categories</a></td> 378 <td><a href="links.import.php">Import Blogroll</a></td> 379 </tr> 371 380 <tr> 372 381 <td> … … 419 428 <div class="wrap"> 420 429 421 430 <form name="links" id="links" method="post"> 422 431 <input type="hidden" name="link_id" value="" /> 423 432 <input type="hidden" name="action" value="" /> … … 425 434 <input type="hidden" name="cat_id" value="<?php echo $cat_id ?>" /> 426 435 <table width="100%" border="0" cellspacing="0" cellpadding="5"> 427 <tr> 436 <tr> 428 437 <th width="15%">Name</th> 429 438 <th>URL</th> 430 439 <th>Category</th> 431 <th>Rel evance</th>440 <th>Relationship</th> 432 441 <th>Image</th> 433 442 <th>Visible</th> … … 442 451 LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id 443 452 LEFT JOIN $tableusers on $tableusers.ID = $tablelinks.link_owner "; 444 453 445 454 // have we got a where clause? 446 455 if (($use_adminlevels) || (isset($cat_id) && ($cat_id != 'All')) ) { … … 465 474 if ($links) { 466 475 foreach ($links as $link) { 467 $short_url = str_replace('http://', '', $link->link_url);476 $short_url = str_replace('http://', '', stripslashes($link->link_url)); 468 477 $short_url = str_replace('www.', '', $short_url); 469 if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); 470 if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; 471 478 if ('/' == substr($short_url, -1)) 479 $short_url = substr($short_url, 0, -1); 480 if (strlen($short_url) > 35) 481 $short_url = substr($short_url, 0, 32).'...'; 482 472 483 $link->link_name = stripslashes($link->link_name); 473 484 $link->category = stripslashes($link->category); 474 485 $link->link_rel = stripslashes($link->link_rel); 486 $link->link_description = stripslashes($link->link_description); 475 487 $image = ($link->link_image != null) ? 'Yes' : 'No'; 476 488 $visible = ($link->link_visible == 'Y') ? 'Yes' : 'No'; … … 478 490 $style = ($i % 2) ? ' class="alternate"' : ''; 479 491 echo <<<LINKS 480 <tr valign="middle"$style> 481 <td><strong>$link->link_name</strong><br /> 482 Description: $link->link_description</td> 483 <td><a href="$link->link_url" title="Visit $link->link_name">$short_url</a></td> 484 <td>$link->category</td> 485 <td>$link->link_rel</td> 486 <td>$image</td> 487 <td>$visible</td> 488 <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> 489 <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> 490 </tr> 492 <tr valign="middle"$style> 493 <td><strong>$link->link_name</strong><br /> 494 Description: $link->link_description</td> 495 <td><a href="$link->link_url" title="Visit $link->link_name">$short_url</a></td> 496 <td>$link->category</td> 497 <td>$link->link_rel</td> 498 <td>$image</td> 499 <td>$visible</td> 500 <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> 501 <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> 502 </tr> 503 491 504 LINKS; 492 505 } … … 512 525 <tr height="20"> 513 526 <td height="20" align="right">Display Name/Alt text:</td> 514 <td><input type="text" name="name" size="80" value="<?php echo $ name; ?>"></td>527 <td><input type="text" name="name" size="80" value="<?php echo $link_name; ?>"></td> 515 528 </tr> 516 529 <tr height="20"> … … 525 538 <td height="20" align="right">Rel:</td> 526 539 <td><input type="text" name="rel" size="80" value=""></td> 540 </tr> 541 <tr height="20"> 542 <td height="20" valign="top" align="right">Notes:</td> 543 <td><textarea name="notes" cols="80" rows="10"></textarea></td> 527 544 </tr> 528 545 <tr height="20"> … … 540 557 <tr height="20"> 541 558 <td height="20" align="right">Target:</td> 542 <td><label><input type="radio" name="target" 543 <label><input type="radio" name="target" value="_top"> 544 _top</label> <label><input type="radio" name="target" value="" checked="checked">545 none</label></td>559 <td><label><input type="radio" name="target" value="_blank"> _blank</label> 560 <label><input type="radio" name="target" value="_top"> _top</label> 561 <label><input type="radio" name="target" value="" checked="checked"> none</label> 562 </td> 546 563 </tr> 547 564 <tr height="20"> 548 565 <td height="20" align="right">Visible:</td> 549 566 <td><label> 550 <input type="radio" name="visible" checked="checked" value="Y">551 Y</label>552 553 <label>554 <input type="radio" name="visible" value="N">555 N</label></td>556 </tr> 557 <tr height="20"> 558 <td height="20" align="right"> Category:</td>567 <input type="radio" name="visible" checked="checked" value="Y"> 568 Yes</label> 569 <label> 570 <input type="radio" name="visible" value="N"> 571 No</label> 572 </td> 573 </tr> 574 <tr height="20"> 575 <td height="20" align="right"><label for="category">Category</label>:</td> 559 576 <td> 560 577 <?php
Note: See TracChangeset
for help on using the changeset viewer.