summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-05 12:50:28 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-05 12:50:28 +0000
commit0b06c68b988410c49c9f4ffbf8c3160d4e9da2c7 (patch)
treef0dc6e87c58f3e0f7315e2808ab88a2f81ba1c52 /modules
parent4e9d1f7d1c97600113edc7bba3f49b59d0bdcb20 (diff)
downloadbrdo-0b06c68b988410c49c9f4ffbf8c3160d4e9da2c7.tar.gz
brdo-0b06c68b988410c49c9f4ffbf8c3160d4e9da2c7.tar.bz2
- Patch #288039 by sun, ff1, agentrickard, fgm, ultimateboy: improved usability of the aliased URL admin page.
Diffstat (limited to 'modules')
-rw-r--r--modules/blogapi/blogapi.module4
-rw-r--r--modules/path/path.admin.inc14
-rw-r--r--modules/poll/poll.install14
-rw-r--r--modules/poll/poll.module32
-rw-r--r--modules/poll/poll.pages.inc4
-rw-r--r--modules/profile/profile.admin.inc22
-rw-r--r--modules/profile/profile.install16
-rw-r--r--modules/profile/profile.module22
-rw-r--r--modules/profile/profile.pages.inc12
-rw-r--r--modules/profile/profile.test2
-rw-r--r--modules/system/system.css2
-rw-r--r--modules/taxonomy/taxonomy.install10
-rw-r--r--modules/taxonomy/taxonomy.module20
13 files changed, 106 insertions, 68 deletions
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index 6ada341c3..a947dbfec 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -584,7 +584,7 @@ function blogapi_mt_validate_terms($node) {
$term_list = array_unique($node->taxonomy);
$params = $term_list;
$params[] = $node->type;
- $result = db_query(db_rewrite_sql("SELECT t.tid, t.vid FROM {term_data} t INNER JOIN {vocabulary_node_types} n ON t.vid = n.vid WHERE t.tid IN (". db_placeholders($term_list) .") AND n.type = '%s'", 't', 'tid'), $params);
+ $result = db_query(db_rewrite_sql("SELECT t.tid, t.vid FROM {term_data} t INNER JOIN {vocabulary_node_type} n ON t.vid = n.vid WHERE t.tid IN (". db_placeholders($term_list) .") AND n.type = '%s'", 't', 'tid'), $params);
$found_terms = array();
$found_count = 0;
while ($term = db_fetch_object($result)) {
@@ -597,7 +597,7 @@ function blogapi_mt_validate_terms($node) {
}
}
// Look up all the vocabularies for this node type.
- $result2 = db_query(db_rewrite_sql("SELECT v.vid, v.name, v.required, v.multiple FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s'", 'v', 'vid'), $node->type);
+ $result2 = db_query(db_rewrite_sql("SELECT v.vid, v.name, v.required, v.multiple FROM {vocabulary} v INNER JOIN {vocabulary_node_type} n ON v.vid = n.vid WHERE n.type = '%s'", 'v', 'vid'), $node->type);
// Check each vocabulary associated with this node type.
while ($vocabulary = db_fetch_object($result2)) {
// Required vocabularies must have at least one term.
diff --git a/modules/path/path.admin.inc b/modules/path/path.admin.inc
index 664f82d06..41853a945 100644
--- a/modules/path/path.admin.inc
+++ b/modules/path/path.admin.inc
@@ -42,9 +42,19 @@ function path_admin_overview($keys = NULL) {
$rows = array();
$destination = drupal_get_destination();
while ($data = db_fetch_object($result)) {
- $row = array(check_plain($data->dst), check_plain($data->src), l(t('edit'), "admin/build/path/edit/$data->pid", array('query' => $destination)), l(t('delete'), "admin/build/path/delete/$data->pid", array('query' => $destination)));
+ $row = array(
+ // If the system path maps to a different URL alias, highlight this table
+ // row to let the user know of old aliases.
+ 'class' => ($data->dst != drupal_get_path_alias($data->src, $data->language) ? 'warning' : NULL),
+ 'data' => array(
+ l($data->dst, $data->src),
+ l($data->src, $data->src, array('alias' => TRUE)),
+ l(t('edit'), "admin/build/path/edit/$data->pid", array('query' => $destination)),
+ l(t('delete'), "admin/build/path/delete/$data->pid", array('query' => $destination)),
+ ),
+ );
if ($multilanguage) {
- array_splice($row, 2, 0, module_invoke('locale', 'language_name', $data->language));
+ array_splice($row['data'], 2, 0, module_invoke('locale', 'language_name', $data->language));
}
$rows[] = $row;
}
diff --git a/modules/poll/poll.install b/modules/poll/poll.install
index 3e2f9edd8..b560aad0b 100644
--- a/modules/poll/poll.install
+++ b/modules/poll/poll.install
@@ -48,7 +48,7 @@ function poll_schema() {
'primary key' => array('nid'),
);
- $schema['poll_choices'] = array(
+ $schema['poll_choice'] = array(
'description' => 'Stores information about all choices for all {poll}s.',
'fields' => array(
'chid' => array(
@@ -91,7 +91,7 @@ function poll_schema() {
'primary key' => array('chid'),
);
- $schema['poll_votes'] = array(
+ $schema['poll_vote'] = array(
'description' => 'Stores per-{users} votes for each {poll}.',
'fields' => array(
'chid' => array(
@@ -131,3 +131,13 @@ function poll_schema() {
return $schema;
}
+
+/**
+ * Rename {poll_choices} table to {poll_choice} and {poll_votes} to {poll_vote}.
+ */
+function poll_update_7001() {
+ $ret = array();
+ db_rename_table($ret, 'poll_choices', 'poll_choice');
+ db_rename_table($ret, 'poll_votes', 'poll_vote');
+ return $ret;
+}
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index f1b725424..2cbd8edcd 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -457,7 +457,7 @@ function poll_load($node) {
$poll = db_fetch_object(db_query("SELECT runtime, active FROM {poll} WHERE nid = %d", $node->nid));
// Load the appropriate choices into the $poll object.
- $result = db_query("SELECT chid, chtext, chvotes, weight FROM {poll_choices} WHERE nid = %d ORDER BY weight", $node->nid);
+ $result = db_query("SELECT chid, chtext, chvotes, weight FROM {poll_choice} WHERE nid = %d ORDER BY weight", $node->nid);
while ($choice = db_fetch_array($result)) {
$poll->choice[$choice['chid']] = $choice;
}
@@ -466,10 +466,10 @@ function poll_load($node) {
$poll->allowvotes = FALSE;
if (user_access('vote on polls') && $poll->active) {
if ($user->uid) {
- $result = db_fetch_object(db_query('SELECT chid FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
+ $result = db_fetch_object(db_query('SELECT chid FROM {poll_vote} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
}
else {
- $result = db_fetch_object(db_query("SELECT chid FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, ip_address()));
+ $result = db_fetch_object(db_query("SELECT chid FROM {poll_vote} WHERE nid = %d AND hostname = '%s'", $node->nid, ip_address()));
}
if (isset($result->chid)) {
$poll->vote = $result->chid;
@@ -498,7 +498,7 @@ function poll_insert($node) {
foreach ($node->choice as $choice) {
if ($choice['chtext'] != '') {
- db_query("INSERT INTO {poll_choices} (nid, chtext, chvotes, weight) VALUES (%d, '%s', %d, %d)", $node->nid, $choice['chtext'], $choice['chvotes'], $choice['weight']);
+ db_query("INSERT INTO {poll_choice} (nid, chtext, chvotes, weight) VALUES (%d, '%s', %d, %d)", $node->nid, $choice['chtext'], $choice['chvotes'], $choice['weight']);
}
}
}
@@ -515,14 +515,14 @@ function poll_update($node) {
foreach ($node->choice as $key => $choice) {
if (!empty($choice['chtext'])) {
if (isset($choice['chid'])) {
- db_query("UPDATE {poll_choices} SET chtext = '%s', chvotes = %d, weight = %d WHERE chid = %d", $choice['chtext'], (int)$choice['chvotes'], $choice['weight'], $choice['chid']);
+ db_query("UPDATE {poll_choice} SET chtext = '%s', chvotes = %d, weight = %d WHERE chid = %d", $choice['chtext'], (int)$choice['chvotes'], $choice['weight'], $choice['chid']);
}
else {
- db_query("INSERT INTO {poll_choices} (nid, chtext, chvotes, weight) VALUES (%d, '%s', %d, %d)", $node->nid, $choice['chtext'], (int)$choice['chvotes'], $choice['weight']);
+ db_query("INSERT INTO {poll_choice} (nid, chtext, chvotes, weight) VALUES (%d, '%s', %d, %d)", $node->nid, $choice['chtext'], (int)$choice['chvotes'], $choice['weight']);
}
}
else {
- db_query("DELETE FROM {poll_votes} WHERE nid = %d AND chid = %d", $node->nid, $key);
+ db_query("DELETE FROM {poll_vote} WHERE nid = %d AND chid = %d", $node->nid, $key);
}
}
}
@@ -532,8 +532,8 @@ function poll_update($node) {
*/
function poll_delete($node) {
db_query("DELETE FROM {poll} WHERE nid = %d", $node->nid);
- db_query("DELETE FROM {poll_choices} WHERE nid = %d", $node->nid);
- db_query("DELETE FROM {poll_votes} WHERE nid = %d", $node->nid);
+ db_query("DELETE FROM {poll_choice} WHERE nid = %d", $node->nid);
+ db_query("DELETE FROM {poll_vote} WHERE nid = %d", $node->nid);
}
/**
@@ -648,14 +648,14 @@ function poll_vote($form, &$form_state) {
global $user;
if ($user->uid) {
- db_query('INSERT INTO {poll_votes} (nid, chid, uid) VALUES (%d, %d, %d)', $node->nid, $choice, $user->uid);
+ db_query('INSERT INTO {poll_vote} (nid, chid, uid) VALUES (%d, %d, %d)', $node->nid, $choice, $user->uid);
}
else {
- db_query("INSERT INTO {poll_votes} (nid, chid, hostname) VALUES (%d, %d, '%s')", $node->nid, $choice, ip_address());
+ db_query("INSERT INTO {poll_vote} (nid, chid, hostname) VALUES (%d, %d, '%s')", $node->nid, $choice, ip_address());
}
// Add one to the votes.
- db_query("UPDATE {poll_choices} SET chvotes = chvotes + 1 WHERE chid = %d", $choice);
+ db_query("UPDATE {poll_choice} SET chvotes = chvotes + 1 WHERE chid = %d", $choice);
cache_clear_all();
drupal_set_message(t('Your vote was recorded.'));
@@ -823,20 +823,20 @@ function poll_cancel($form, &$form_state) {
global $user;
if ($user->uid) {
- db_query('DELETE FROM {poll_votes} WHERE nid = %d and uid = %d', $node->nid, $user->uid);
+ db_query('DELETE FROM {poll_vote} WHERE nid = %d and uid = %d', $node->nid, $user->uid);
}
else {
- db_query("DELETE FROM {poll_votes} WHERE nid = %d and hostname = '%s'", $node->nid, ip_address());
+ db_query("DELETE FROM {poll_vote} WHERE nid = %d and hostname = '%s'", $node->nid, ip_address());
}
// Subtract from the votes.
- db_query("UPDATE {poll_choices} SET chvotes = chvotes - 1 WHERE chid = %d", $node->vote);
+ db_query("UPDATE {poll_choice} SET chvotes = chvotes - 1 WHERE chid = %d", $node->vote);
}
/**
* Implementation of hook_user_delete().
*/
function poll_user_delete(&$edit, &$user) {
- db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid);
+ db_query('UPDATE {poll_vote} SET uid = 0 WHERE uid = %d', $user->uid);
}
diff --git a/modules/poll/poll.pages.inc b/modules/poll/poll.pages.inc
index 61f3bf6c2..7c2bd0c29 100644
--- a/modules/poll/poll.pages.inc
+++ b/modules/poll/poll.pages.inc
@@ -11,7 +11,7 @@
*/
function poll_page() {
// List all polls.
- $sql = db_rewrite_sql("SELECT n.nid, n.title, p.active, n.created, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choices} c ON n.nid = c.nid WHERE n.status = 1 GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC");
+ $sql = db_rewrite_sql("SELECT n.nid, n.title, p.active, n.created, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choice} c ON n.nid = c.nid WHERE n.status = 1 GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC");
// Count all polls for the pager.
$count_sql = db_rewrite_sql('SELECT COUNT(*) FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid WHERE n.status = 1');
$result = pager_query($sql, 15, 0, $count_sql);
@@ -35,7 +35,7 @@ function poll_votes($node) {
$header[] = array('data' => t('Vote'), 'field' => 'pv.chorder');
$header[] = array('data' => t('Vote'), 'field' => 'pc.weight');
- $result = pager_query("SELECT pv.chid, pv.uid, pv.hostname, u.name FROM {poll_votes} pv INNER JOIN {poll_choices} pc ON pv.chid = pc.chid LEFT JOIN {users} u ON pv.uid = u.uid WHERE pv.nid = %d". tablesort_sql($header), 20, 0, NULL, $node->nid);
+ $result = pager_query("SELECT pv.chid, pv.uid, pv.hostname, u.name FROM {poll_vote} pv INNER JOIN {poll_choice} pc ON pv.chid = pc.chid LEFT JOIN {users} u ON pv.uid = u.uid WHERE pv.nid = %d". tablesort_sql($header), 20, 0, NULL, $node->nid);
$rows = array();
while ($vote = db_fetch_object($result)) {
$rows[] = array(
diff --git a/modules/profile/profile.admin.inc b/modules/profile/profile.admin.inc
index 16f5860e4..3e154fb83 100644
--- a/modules/profile/profile.admin.inc
+++ b/modules/profile/profile.admin.inc
@@ -13,7 +13,7 @@
* @see profile_admin_overview_submit()
*/
function profile_admin_overview() {
- $result = db_query('SELECT title, name, type, category, fid, weight FROM {profile_fields} ORDER BY category, weight');
+ $result = db_query('SELECT title, name, type, category, fid, weight FROM {profile_field} ORDER BY category, weight');
$form = array();
$categories = array();
@@ -74,7 +74,7 @@ function profile_admin_overview_submit($form, &$form_state) {
$weight = $form_state['values'][$fid]['weight'];
$category = $form_state['values'][$fid]['category'];
if ($weight != $form[$fid]['weight']['#default_value'] || $category != $form[$fid]['category']['#default_value']) {
- db_query("UPDATE {profile_fields} SET weight = %d, category = '%s' WHERE fid = %d", $weight, $category, $fid);
+ db_query("UPDATE {profile_field} SET weight = %d, category = '%s' WHERE fid = %d", $weight, $category, $fid);
}
}
}
@@ -169,7 +169,7 @@ function profile_field_form(&$form_state, $arg = NULL) {
if (is_numeric($arg)) {
$fid = $arg;
- $edit = db_fetch_array(db_query('SELECT * FROM {profile_fields} WHERE fid = %d', $fid));
+ $edit = db_fetch_array(db_query('SELECT * FROM {profile_field} WHERE fid = %d', $fid));
if (!$edit) {
drupal_not_found();
@@ -314,10 +314,10 @@ function profile_field_form_validate($form, &$form_state) {
$query_suffix = ' AND fid != %d';
}
- if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE title = '%s' AND category = '%s'" . $query_suffix, $args1))) {
+ if (db_result(db_query("SELECT fid FROM {profile_field} WHERE title = '%s' AND category = '%s'" . $query_suffix, $args1))) {
form_set_error('title', t('The specified title is already in use.'));
}
- if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'" . $query_suffix, $args2))) {
+ if (db_result(db_query("SELECT fid FROM {profile_field} WHERE name = '%s'" . $query_suffix, $args2))) {
form_set_error('name', t('The specified name is already in use.'));
}
if ($form_state['values']['visibility'] == PROFILE_HIDDEN) {
@@ -341,13 +341,13 @@ function profile_field_form_submit($form, &$form_state) {
$form_state['values']['page'] = '';
}
if (!isset($form_state['values']['fid'])) {
- db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s', '%s')", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['type'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page']);
+ db_query("INSERT INTO {profile_field} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s', '%s')", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['type'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page']);
drupal_set_message(t('The field has been created.'));
watchdog('profile', 'Profile field %field added under category %category.', array('%field' => $form_state['values']['title'], '%category' => $form_state['values']['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile'));
}
else {
- db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, autocomplete = %d, options = '%s', page = '%s' WHERE fid = %d", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page'], $form_state['values']['fid']);
+ db_query("UPDATE {profile_field} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, autocomplete = %d, options = '%s', page = '%s' WHERE fid = %d", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page'], $form_state['values']['fid']);
drupal_set_message(t('The field has been updated.'));
}
@@ -362,7 +362,7 @@ function profile_field_form_submit($form, &$form_state) {
* Menu callback; deletes a field from all user profiles.
*/
function profile_field_delete(&$form_state, $fid) {
- $field = db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d", $fid));
+ $field = db_fetch_object(db_query("SELECT title FROM {profile_field} WHERE fid = %d", $fid));
if (!$field) {
drupal_not_found();
return;
@@ -380,8 +380,8 @@ function profile_field_delete(&$form_state, $fid) {
* Process a field delete form submission.
*/
function profile_field_delete_submit($form, &$form_state) {
- db_query('DELETE FROM {profile_fields} WHERE fid = %d', $form_state['values']['fid']);
- db_query('DELETE FROM {profile_values} WHERE fid = %d', $form_state['values']['fid']);
+ db_query('DELETE FROM {profile_field} WHERE fid = %d', $form_state['values']['fid']);
+ db_query('DELETE FROM {profile_value} WHERE fid = %d', $form_state['values']['fid']);
cache_clear_all();
@@ -397,7 +397,7 @@ function profile_field_delete_submit($form, &$form_state) {
*/
function profile_admin_settings_autocomplete($string) {
$matches = array();
- $result = db_query_range("SELECT category FROM {profile_fields} WHERE LOWER(category) LIKE LOWER(:category)", array(':category' => $string .'%'), 0, 10);
+ $result = db_query_range("SELECT category FROM {profile_field} WHERE LOWER(category) LIKE LOWER(:category)", array(':category' => $string .'%'), 0, 10);
while ($data = db_fetch_object($result)) {
$matches[$data->category] = check_plain($data->category);
}
diff --git a/modules/profile/profile.install b/modules/profile/profile.install
index e21d8a11a..a4c1fd24f 100644
--- a/modules/profile/profile.install
+++ b/modules/profile/profile.install
@@ -23,7 +23,7 @@ function profile_uninstall() {
* Implementation of hook_schema().
*/
function profile_schema() {
- $schema['profile_fields'] = array(
+ $schema['profile_field'] = array(
'description' => 'Stores profile field information.',
'fields' => array(
'fid' => array(
@@ -117,7 +117,7 @@ function profile_schema() {
'primary key' => array('fid'),
);
- $schema['profile_values'] = array(
+ $schema['profile_value'] = array(
'description' => 'Stores values for profile fields.',
'fields' => array(
'fid' => array(
@@ -125,7 +125,7 @@ function profile_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
- 'description' => 'The {profile_fields}.fid of the field.',
+ 'description' => 'The {profile_field}.fid of the field.',
),
'uid' => array(
'type' => 'int',
@@ -148,3 +148,13 @@ function profile_schema() {
return $schema;
}
+
+/**
+ * Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
+ */
+function profile_update_7001() {
+ $ret = array();
+ db_rename_table($ret, 'profile_fields', 'profile_field');
+ db_rename_table($ret, 'profile_values', 'profile_value');
+ return $ret;
+}
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 9352f4b3b..6ecd27c67 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -138,7 +138,7 @@ function profile_block($op = 'list', $delta = '', $edit = array()) {
elseif ($op == 'configure') {
// Compile a list of fields to show
$fields = array();
- $result = db_query('SELECT name, title, weight, visibility FROM {profile_fields} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
+ $result = db_query('SELECT name, title, weight, visibility FROM {profile_field} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[$record->name] = check_plain($record->title);
}
@@ -165,7 +165,7 @@ function profile_block($op = 'list', $delta = '', $edit = array()) {
if ($use_fields = variable_get('profile_block_author_fields', array())) {
// Compile a list of fields to show.
$fields = array();
- $result = db_query('SELECT name, title, type, visibility, weight FROM {profile_fields} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
+ $result = db_query('SELECT name, title, type, visibility, weight FROM {profile_field} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
// Ensure that field is displayed only if it is among the defined block fields and, if it is private, the user has appropriate permissions.
if (isset($use_fields[$record->name]) && $use_fields[$record->name]) {
@@ -253,11 +253,11 @@ function profile_user_categories(&$edit, &$user, $category = NULL) {
* Implementation of hook_user_delete().
*/
function profile_user_delete(&$edit, &$user, $category = NULL) {
- db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid);
+ db_query('DELETE FROM {profile_value} WHERE uid = %d', $user->uid);
}
function profile_load_profile(&$user) {
- $result = db_query('SELECT f.name, f.type, v.value FROM {profile_fields} f INNER JOIN {profile_values} v ON f.fid = v.fid WHERE uid = %d', $user->uid);
+ $result = db_query('SELECT f.name, f.type, v.value FROM {profile_field} f INNER JOIN {profile_value} v ON f.fid = v.fid WHERE uid = %d', $user->uid);
while ($field = db_fetch_object($result)) {
if (empty($user->{$field->name})) {
$user->{$field->name} = _profile_field_serialize($field->type) ? unserialize($field->value) : $field->value;
@@ -271,8 +271,8 @@ function profile_save_profile(&$edit, &$user, $category, $register = FALSE) {
if (_profile_field_serialize($field->type)) {
$edit[$field->name] = serialize($edit[$field->name]);
}
- db_query("DELETE FROM {profile_values} WHERE fid = %d AND uid = %d", $field->fid, $user->uid);
- db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]);
+ db_query("DELETE FROM {profile_value} WHERE fid = %d AND uid = %d", $field->fid, $user->uid);
+ db_query("INSERT INTO {profile_value} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]);
// Mark field as handled (prevents saving to user->data).
$edit[$field->name] = NULL;
}
@@ -331,10 +331,10 @@ function profile_view_profile(&$user) {
// Show private fields to administrators and people viewing their own account.
if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) {
- $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN);
+ $result = db_query('SELECT * FROM {profile_field} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN);
}
else {
- $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN);
+ $result = db_query('SELECT * FROM {profile_field} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN);
}
$fields = array();
@@ -480,7 +480,7 @@ function profile_validate_profile($edit, $category) {
}
function profile_categories() {
- $result = db_query("SELECT DISTINCT(category) FROM {profile_fields}");
+ $result = db_query("SELECT DISTINCT(category) FROM {profile_field}");
$data = array();
while ($category = db_fetch_object($result)) {
$data[] = array(
@@ -502,7 +502,7 @@ function profile_category_access($account, $category) {
return TRUE;
}
else {
- return user_edit_access($account) && db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE category = '%s' AND visibility <> %d", $category, PROFILE_HIDDEN));
+ return user_edit_access($account) && db_result(db_query("SELECT COUNT(*) FROM {profile_field} WHERE category = '%s' AND visibility <> %d", $category, PROFILE_HIDDEN));
}
}
@@ -589,7 +589,7 @@ function _profile_field_serialize($type = NULL) {
function _profile_get_fields($category, $register = FALSE) {
$args = array();
- $sql = 'SELECT * FROM {profile_fields} WHERE ';
+ $sql = 'SELECT * FROM {profile_field} WHERE ';
$filters = array();
if ($register) {
$filters[] = 'register = 1';
diff --git a/modules/profile/profile.pages.inc b/modules/profile/profile.pages.inc
index fa8dbef31..9cb761a28 100644
--- a/modules/profile/profile.pages.inc
+++ b/modules/profile/profile.pages.inc
@@ -13,7 +13,7 @@ function profile_browse() {
// Ensure that the path is converted to 3 levels always.
list(, $name, $value) = array_pad(explode('/', $_GET['q'], 3), 3, '');
- $field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page, visibility FROM {profile_fields} WHERE name = '%s'", $name));
+ $field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page, visibility FROM {profile_field} WHERE name = '%s'", $name));
if ($name && $field->fid) {
// Only allow browsing of fields that have a page title set.
@@ -29,7 +29,7 @@ function profile_browse() {
// Compile a list of fields to show.
$fields = array();
- $result = db_query('SELECT name, title, type, weight, page FROM {profile_fields} WHERE fid != %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS);
+ $result = db_query('SELECT name, title, type, weight, page FROM {profile_field} WHERE fid != %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
@@ -55,7 +55,7 @@ function profile_browse() {
}
// Extract the affected users:
- $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments);
+ $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_value} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments);
$content = '';
while ($account = db_fetch_object($result)) {
@@ -82,7 +82,7 @@ function profile_browse() {
else {
// Compile a list of fields to show.
$fields = array();
- $result = db_query('SELECT name, title, type, weight, page, visibility FROM {profile_fields} WHERE visibility = %d ORDER BY category, weight', PROFILE_PUBLIC_LISTINGS);
+ $result = db_query('SELECT name, title, type, weight, page, visibility FROM {profile_field} WHERE visibility = %d ORDER BY category, weight', PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
@@ -109,8 +109,8 @@ function profile_browse() {
*/
function profile_autocomplete($field, $string) {
$matches = array();
- if (db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE fid = %d AND autocomplete = 1", $field))) {
- $result = db_query_range("SELECT value FROM {profile_values} WHERE fid = :fid AND LOWER(value) LIKE LOWER(:value) GROUP BY value ORDER BY value ASC", array(
+ if (db_result(db_query("SELECT COUNT(*) FROM {profile_field} WHERE fid = %d AND autocomplete = 1", $field))) {
+ $result = db_query_range("SELECT value FROM {profile_value} WHERE fid = :fid AND LOWER(value) LIKE LOWER(:value) GROUP BY value ORDER BY value ASC", array(
':fid' => $field,
':value' => $string .'%',
), 0, 10);
diff --git a/modules/profile/profile.test b/modules/profile/profile.test
index 4ffa92130..7dd22c043 100644
--- a/modules/profile/profile.test
+++ b/modules/profile/profile.test
@@ -37,7 +37,7 @@ class ProfileTestCase extends DrupalWebTestCase {
$edit['explanation'] = $this->randomName(50);
$this->drupalPost('admin/user/profile/add/' . $type, $edit, t('Save field'));
- $fid = db_result(db_query("SELECT fid FROM {profile_fields} WHERE title = '%s'", $title));
+ $fid = db_result(db_query("SELECT fid FROM {profile_field} WHERE title = '%s'", $title));
$this->assertTrue($fid, t('New Profile field has been entered in the database'));
// Check that the new field is appearing on the user edit form.
diff --git a/modules/system/system.css b/modules/system/system.css
index 72c0816ba..abd34d249 100644
--- a/modules/system/system.css
+++ b/modules/system/system.css
@@ -77,7 +77,7 @@ div.error, tr.error {
div.warning {
border: 1px solid #f0c020;
}
-div.warning, tr.warning {
+div.warning, table tr.warning {
background: #ffd;
color: #220;
padding: 2px;
diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install
index 12e99c687..fb3f0ff1b 100644
--- a/modules/taxonomy/taxonomy.install
+++ b/modules/taxonomy/taxonomy.install
@@ -257,7 +257,7 @@ function taxonomy_schema() {
),
);
- $schema['vocabulary_node_types'] = array(
+ $schema['vocabulary_node_type'] = array(
'description' => 'Stores which node types vocabularies may be used with.',
'fields' => array(
'vid' => array(
@@ -284,3 +284,11 @@ function taxonomy_schema() {
return $schema;
}
+/**
+ * Rename {vocabulary_node_types} table to {vocabulary_node_type}.
+ */
+function taxonomy_update_7001() {
+ $ret = array();
+ db_rename_table($ret, 'vocabulary_node_types', 'vocabulary_node_type');
+ return $ret;
+}
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 28f85d994..958f83773 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -227,16 +227,16 @@ function taxonomy_vocabulary_save($vocabulary) {
if (!empty($vocabulary->vid) && !empty($vocabulary->name)) {
$status = drupal_write_record('vocabulary', $vocabulary, 'vid');
- db_query("DELETE FROM {vocabulary_node_types} WHERE vid = %d", $vocabulary->vid);
+ db_query("DELETE FROM {vocabulary_node_type} WHERE vid = %d", $vocabulary->vid);
foreach ($vocabulary->nodes as $type => $selected) {
- db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $vocabulary->vid, $type);
+ db_query("INSERT INTO {vocabulary_node_type} (vid, type) VALUES (%d, '%s')", $vocabulary->vid, $type);
}
module_invoke_all('taxonomy_vocabulary_update', $vocabulary);
}
elseif (empty($vocabulary->vid)) {
$status = drupal_write_record('vocabulary', $vocabulary);
foreach ($vocabulary->nodes as $type => $selected) {
- db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $vocabulary->vid, $type);
+ db_query("INSERT INTO {vocabulary_node_type} (vid, type) VALUES (%d, '%s')", $vocabulary->vid, $type);
}
module_invoke_all('taxonomy_vocabulary_insert', $vocabulary);
}
@@ -258,7 +258,7 @@ function taxonomy_vocabulary_delete($vid) {
$vocabulary = (array) taxonomy_vocabulary_load($vid);
db_query('DELETE FROM {vocabulary} WHERE vid = %d', $vid);
- db_query('DELETE FROM {vocabulary_node_types} WHERE vid = %d', $vid);
+ db_query('DELETE FROM {vocabulary_node_type} WHERE vid = %d', $vid);
$result = db_query('SELECT tid FROM {term_data} WHERE vid = %d', $vid);
while ($term = db_fetch_object($result)) {
taxonomy_term_delete($term->tid);
@@ -469,10 +469,10 @@ function taxonomy_form_all($free_tags = 0) {
*/
function taxonomy_get_vocabularies($type = NULL) {
if ($type) {
- $result = db_query(db_rewrite_sql("SELECT v.vid, v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $type);
+ $result = db_query(db_rewrite_sql("SELECT v.vid, v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_type} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $type);
}
else {
- $result = db_query(db_rewrite_sql('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid ORDER BY v.weight, v.name', 'v', 'vid'));
+ $result = db_query(db_rewrite_sql('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_type} n ON v.vid = n.vid ORDER BY v.weight, v.name', 'v', 'vid'));
}
$vocabularies = array();
@@ -516,7 +516,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) {
$terms = $node->taxonomy;
}
- $c = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $node->type);
+ $c = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_type} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $node->type);
while ($vocabulary = db_fetch_object($c)) {
if ($vocabulary->tags) {
@@ -739,10 +739,10 @@ function taxonomy_node_delete_revision($node) {
*/
function taxonomy_node_type($op, $info) {
if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) {
- db_query("UPDATE {vocabulary_node_types} SET type = '%s' WHERE type = '%s'", $info->type, $info->old_type);
+ db_query("UPDATE {vocabulary_node_type} SET type = '%s' WHERE type = '%s'", $info->type, $info->old_type);
}
elseif ($op == 'delete') {
- db_query("DELETE FROM {vocabulary_node_types} WHERE type = '%s'", $info->type);
+ db_query("DELETE FROM {vocabulary_node_type} WHERE type = '%s'", $info->type);
}
}
@@ -1022,7 +1022,7 @@ function taxonomy_vocabulary_load($vid, $reset = FALSE) {
// that cached, and we will not try to load this later.
$vocabularies[$vid] = FALSE;
// Try to load the data and fill up the object.
- $result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d', $vid);
+ $result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_type} n ON v.vid = n.vid WHERE v.vid = %d', $vid);
$node_types = array();
while ($voc = db_fetch_object($result)) {
if (!empty($voc->type)) {