Make WordPress Core


Ignore:
Timestamp:
05/24/2004 08:22:18 AM (21 years ago)
Author:
saxmatt
Message:

Giant commit, sorry mailing list people. Move all table names to new $wpdb versions. Works but the whole app needs thorough testing now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-manager.php

    r1352 r1355  
    2121
    2222function category_dropdown($fieldname, $selected = 0) {
    23     global $wpdb, $tablelinkcategories;
     23    global $wpdb;
    2424   
    25     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
     25    $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
    2626    echo "\n<select name='$fieldname' size='1'>";
    2727    foreach ($results as $row) {
     
    100100    }
    101101    $all_links = join(',', $linkcheck);
    102     $results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $tablelinks LEFT JOIN $tableusers ON link_owner = ID WHERE link_id in ($all_links)");
     102    $results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $wpdb->links LEFT JOIN $wpdb->users ON link_owner = ID WHERE link_id in ($all_links)");
    103103    foreach ($results as $row) {
    104104      if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed
     
    109109    // should now have an array of links we can change
    110110    $all_links = join(',', $ids_to_change);
    111     $q = $wpdb->query("update $tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)");
     111    $q = $wpdb->query("update $wpdb->links SET link_owner='$newowner' WHERE link_id IN ($all_links)");
    112112
    113113    header('Location: ' . $this_file);
     
    131131    }
    132132    $all_links = join(',', $linkcheck);
    133     $results = $wpdb->get_results("SELECT link_id, link_visible FROM $tablelinks WHERE link_id in ($all_links)");
     133    $results = $wpdb->get_results("SELECT link_id, link_visible FROM $wpdb->links WHERE link_id in ($all_links)");
    134134    foreach ($results as $row) {
    135135        if ($row->link_visible == 'Y') { // ok to proceed
     
    143143    if (count($ids_to_turnoff)) {
    144144        $all_linksoff = join(',', $ids_to_turnoff);
    145         $q = $wpdb->query("update $tablelinks SET link_visible='N' WHERE link_id IN ($all_linksoff)");
     145        $q = $wpdb->query("update $wpdb->links SET link_visible='N' WHERE link_id IN ($all_linksoff)");
    146146    }
    147147
    148148    if (count($ids_to_turnon)) {
    149149        $all_linkson = join(',', $ids_to_turnon);
    150         $q = $wpdb->query("update $tablelinks SET link_visible='Y' WHERE link_id IN ($all_linkson)");
     150        $q = $wpdb->query("update $wpdb->links SET link_visible='Y' WHERE link_id IN ($all_linkson)");
    151151    }
    152152
     
    172172    $all_links = join(',', $linkcheck);
    173173    // should now have an array of links we can change
    174     $q = $wpdb->query("update $tablelinks SET link_category='$category' WHERE link_id IN ($all_links)");
     174    $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
    175175
    176176    header('Location: ' . $this_file);
     
    204204    // need to make the others invisible before we add this new one.
    205205    if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
    206       $wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category");
    207     }
    208     $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, link_rss) " .
     206      $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
     207    }
     208    $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) " .
    209209      " VALUES('" . addslashes($link_url) . "','"
    210210           . addslashes($link_name) . "', '"
     
    254254      // need to make the others invisible before we update this one.
    255255      if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
    256         $wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category");
     256        $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
    257257      }
    258258
    259       $wpdb->query("UPDATE $tablelinks SET link_url='" . addslashes($link_url) . "',
     259      $wpdb->query("UPDATE $wpdb->links SET link_url='" . addslashes($link_url) . "',
    260260      link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "',
    261261      link_target='$link_target',\n link_category=$link_category,
     
    284284      die (__("Cheatin' uh ?"));
    285285
    286     $wpdb->query("DELETE FROM $tablelinks WHERE link_id = $link_id");
     286    $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = $link_id");
    287287
    288288    if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
     
    309309
    310310    $row = $wpdb->get_row("SELECT *
    311     FROM $tablelinks
     311    FROM $wpdb->links
    312312    WHERE link_id = $link_id");
    313313
     
    618618        <td>
    619619<?php
    620     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
     620    $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
    621621    echo "        <select name=\"cat_id\">\n";
    622622    echo "          <option value=\"All\"";
     
    676676<?php
    677677    $sql = "SELECT link_url, link_name, link_image, link_description, link_visible,
    678             link_category AS cat_id, cat_name AS category, $tableusers.user_login, link_id,
    679             link_rating, link_rel, $tableusers.user_level
    680             FROM $tablelinks
    681             LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id
    682             LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner ";
     678            link_category AS cat_id, cat_name AS category, $wpdb->users.user_login, link_id,
     679            link_rating, link_rel, $wpdb->users.user_level
     680            FROM $wpdb->links
     681            LEFT JOIN $wpdb->linkcategories ON $wpdb->links.link_category = $wpdb->linkcategories.cat_id
     682            LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->links.link_owner ";
    683683
    684684    if (isset($cat_id) && ($cat_id != 'All')) {
     
    748748          <?php _e('Assign ownership to:'); echo ' ' . gethelp_link($this_file,'assign_ownership'); ?>
    749749<?php
    750     $results = $wpdb->get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID");
     750    $results = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level > 0 ORDER BY ID");
    751751    echo "          <select name=\"newowner\" size=\"1\">\n";
    752752    foreach ($results as $row) {
Note: See TracChangeset for help on using the changeset viewer.