Changeset 254 for trunk/wp-admin/linkmanager.php
- Timestamp:
- 07/19/2003 08:45:27 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/linkmanager.php
r212 r254 27 27 // Mike Little (mike@zed1.com) 28 28 // ***************************************************************** 29 include_once('../wp-config.php');30 include_once('../wp-links/links.config.php');31 include_once("../wp-links/links.php");29 require_once('../wp-config.php'); 30 require_once('../wp-links/links.config.php'); 31 require_once("../wp-links/links.php"); 32 32 33 33 $title = 'Manage Links'; … … 69 69 70 70 $links_show_cat_id = $HTTP_COOKIE_VARS["links_show_cat_id"]; 71 $links_show_order = $HTTP_COOKIE_VARS["links_show_order"]; 71 72 72 73 // error_log("start, links_show_cat_id=$links_show_cat_id"); … … 95 96 // need to make the others invisible before we add this new one. 96 97 if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { 97 $sql = "UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category"; 98 $sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error()); 99 } 100 101 $sql = "INSERT INTO $tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel) " . 98 $wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category"); 99 } 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) " . 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) ."')"; 106 107 $sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error()); 105 . addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) ."')"); 108 106 109 107 header('Location: linkmanager.php'); … … 145 143 // need to make the others invisible before we update this one. 146 144 if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { 147 $sql = "UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category"; 148 $sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error()); 145 $wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category"); 149 146 } 150 147 151 $ sql ="UPDATE $tablelinks SET link_url='" . addslashes($link_url) . "',\n " .148 $wpdb->query("UPDATE $tablelinks SET link_url='" . addslashes($link_url) . "',\n " . 152 149 " link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "',\n " . 153 150 " link_target='$link_target',\n link_category=$link_category,\n " . … … 155 152 " link_rating=$link_rating,\n" . 156 153 " link_rel='" . addslashes($link_rel) . "'\n" . 157 " WHERE link_id=$link_id" ;154 " WHERE link_id=$link_id"); 158 155 //error_log($sql); 159 $sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());160 161 156 } // end if save 162 157 setcookie('links_show_cat_id', $links_show_cat_id, time()+600); … … 175 170 die ("Cheatin' uh ?"); 176 171 177 $sql = "DELETE FROM $tablelinks WHERE link_id = '$link_id'"; 178 $sql_result = mysql_query($sql) or die("Couldn't execute query.".mysql_error()); 172 $wpdb->query("DELETE FROM $tablelinks WHERE link_id = '$link_id'"); 179 173 180 174 if (isset($links_show_cat_id) && ($links_show_cat_id != '')) … … 199 193 } 200 194 201 $ sql ="SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel " .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 " . 202 196 " FROM $tablelinks " . 203 " WHERE link_id = $link_id"; 204 205 $result = mysql_query($sql) or die("Couldn't execute query.".mysql_error()); 206 if ($row = mysql_fetch_object($result)) { 197 " WHERE link_id = $link_id"); 198 199 if ($row) { 207 200 $link_url = $row->link_url; 208 201 $link_name = stripslashes($row->link_name); … … 287 280 <td> 288 281 <?php 289 $query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"; 290 $result = mysql_query($query) or die("Couldn't execute query. ".mysql_error()); 282 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 291 283 echo " <select name=\"category\" size=\"1\">\n"; 292 while($row = mysql_fetch_object($result)) {284 foreach($results as $row) { 293 285 echo " <option value=\"".$row->cat_id."\""; 294 286 if ($row->cat_id == $link_category) … … 321 313 } 322 314 $links_show_cat_id = $cat_id; 315 if (!isset($order_by) || ($order_by == '')) { 316 if (!isset($links_show_order) || ($links_show_order == '')) 317 $order_by = 'order_name'; 318 } 319 $links_show_order = $order_by; 323 320 //break; fall through 324 321 } // end Show … … 339 336 } 340 337 $links_show_cat_id = $cat_id; 338 if (isset($links_show_order) && ($links_show_order != '')) 339 $order_by = $links_show_order; 340 341 341 if (!isset($order_by) || ($order_by == '')) 342 342 $order_by = 'order_name'; 343 $links_show_order = $order_by; 344 343 345 setcookie('links_show_cat_id', $links_show_cat_id, time()+600); 346 setcookie('links_show_order', $links_show_order, time()+600); 344 347 $standalone=0; 345 348 include_once ("./b2header.php"); … … 377 380 <td> 378 381 <?php 379 $query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"; 380 $result = mysql_query($query) or die("Couldn't execute query. ".mysql_error()); 382 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 381 383 echo " <select name=\"cat_id\">\n"; 382 384 echo " <option value=\"All\""; … … 384 386 echo " selected"; 385 387 echo "> All</option>\n"; 386 while($row = mysql_fetch_object($result)) {388 foreach ($results as $row) { 387 389 echo " <option value=\"".$row->cat_id."\""; 388 390 if ($row->cat_id == $cat_id) … … 434 436 </tr> 435 437 <?php 436 $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 "; 438 $sql = "SELECT link_url, link_name, link_image, link_description, link_visible, 439 link_category AS cat_id, cat_name AS category, $tableusers.user_login, link_id, 440 link_rating, link_rel 441 FROM $tablelinks 442 LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id 443 LEFT JOIN $tableusers on $tableusers.ID = $tablelinks.link_owner "; 444 437 445 // have we got a where clause? 438 446 if (($use_adminlevels) || (isset($cat_id) && ($cat_id != 'All')) ) { 439 447 $sql .= " WHERE "; 440 448 } 449 // FIX ME This make higher level links invisible rather than just uneditable 441 450 if ($use_adminlevels) { 442 451 $sql .= " ($tableusers.user_level <= $user_level" … … 550 559 <td> 551 560 <?php 552 $query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"; 553 $result = mysql_query($query) or die("Couldn't execute query. ".mysql_error()); 561 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 554 562 echo " <select name=\"category\" size=\"1\">\n"; 555 while($row = mysql_fetch_object($result)) {563 foreach ($results as $row) { 556 564 echo " <option value=\"".$row->cat_id."\""; 557 565 if ($row->cat_id == $cat_id)
Note: See TracChangeset
for help on using the changeset viewer.