From 625455b53b0fd13cc9b154bf53a49bd871b6d23a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 14 Oct 2001 15:27:00 +0000 Subject: - I tidied up most SQL tables to be more consistent with the rest of the tables: I changed all "id"s to "xid"s where "x" is the first letter of the table name. I also renamed all remaining "userid"s to "uid"s as I mentioned I would do. Take a look at ./drupal/updates/3.00-to-x.xx.sql for the MySQL updates. --- modules/locale.module | 29 ++++++++++++++--------------- modules/locale/locale.module | 29 ++++++++++++++--------------- modules/rating.module | 4 ++-- modules/watchdog.module | 6 +++--- modules/watchdog/watchdog.module | 6 +++--- 5 files changed, 36 insertions(+), 38 deletions(-) (limited to 'modules') diff --git a/modules/locale.module b/modules/locale.module index abfea68d4..c363e64a7 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -50,23 +50,22 @@ function locale_conf_options() { return form_select("Locale support", "locale", variable_get("locale", 0), array("Disabled", "Enabled"), "Disable locale support if your site does not require translation or internationalization support."); } -function locale_delete($id) { - db_query("DELETE FROM locales WHERE id = '$id'"); +function locale_delete($lid) { + db_query("DELETE FROM locales WHERE lid = '$lid'"); } -function locale_save($id, $edit) { +function locale_save($lid, $edit) { foreach ($edit as $key=>$value) { - db_query("UPDATE locales SET $key = '". check_input($value) ."' WHERE id = '$id'"); + db_query("UPDATE locales SET $key = '". check_input($value) ."' WHERE lid = '$lid'"); } } -function locale_edit($id) { +function locale_edit($lid) { global $languages; - $result = db_query("SELECT * FROM locales WHERE id = '$id'"); + $result = db_query("SELECT * FROM locales WHERE lid = '$lid'"); if ($translation = db_fetch_object($result)) { $form .= form_item(t("Original text"), "
". wordwrap(check_output($translation->string)) ."
"); foreach ($languages as $code=>$language) $form .= (strlen($translation->string) > 30) ? form_textarea($language, $code, $translation->$code, 50, 10) : form_textfield($language, $code, $translation->$code, 50, 128); - $form .= form_hidden("id", $id); $form .= form_submit("Save translations"); return form($form); @@ -104,7 +103,7 @@ function locale_overview() { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."lid\">edit localelid\">delete locale
\n"; @@ -117,7 +116,7 @@ function locale_translated($language) { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
original stringtranslated stringoperations
". check_output($locale->string) ."". check_output($locale->$language) ."id\"> edit localeid\">delete locale
". check_output($locale->string) ."". check_output($locale->$language) ."lid\"> edit localelid\">delete locale
\n"; @@ -130,7 +129,7 @@ function locale_untranslated($language) { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
stringoperations
". check_output($locale->string) ."
$locale->location
id\"> edit localeid\">delete locale
". check_output($locale->string) ."
$locale->location
lid\"> edit localelid\">delete locale
\n"; @@ -138,9 +137,9 @@ function locale_untranslated($language) { } function locale_seek() { - global $edit, $languages, $op, $locale_settings; + global $id, $edit, $languages, $op, $locale_settings; - if ($edit[id] && session_is_registered("locale_settings")) { + if (session_is_registered("locale_settings")) { $edit = $locale_settings; } @@ -173,7 +172,7 @@ function locale_seek() { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."lid\">edit localelid\">delete locale
\n"; } @@ -232,11 +231,11 @@ function locale_admin() { function locale($string) { global $locale; if (variable_get("locale", 0)) { - $result = db_query("SELECT id, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0"); + $result = db_query("SELECT lid, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0"); if ($translation = db_fetch_object($result)) $string = ($translation->$locale) ? check_output($translation->$locale) : $string; else db_query("INSERT INTO locales (string, location) VALUES ('". addslashes($string) ."', '". check_input(getenv("REQUEST_URI")) ."')"); } return $string; } -?> \ No newline at end of file +?> diff --git a/modules/locale/locale.module b/modules/locale/locale.module index abfea68d4..c363e64a7 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -50,23 +50,22 @@ function locale_conf_options() { return form_select("Locale support", "locale", variable_get("locale", 0), array("Disabled", "Enabled"), "Disable locale support if your site does not require translation or internationalization support."); } -function locale_delete($id) { - db_query("DELETE FROM locales WHERE id = '$id'"); +function locale_delete($lid) { + db_query("DELETE FROM locales WHERE lid = '$lid'"); } -function locale_save($id, $edit) { +function locale_save($lid, $edit) { foreach ($edit as $key=>$value) { - db_query("UPDATE locales SET $key = '". check_input($value) ."' WHERE id = '$id'"); + db_query("UPDATE locales SET $key = '". check_input($value) ."' WHERE lid = '$lid'"); } } -function locale_edit($id) { +function locale_edit($lid) { global $languages; - $result = db_query("SELECT * FROM locales WHERE id = '$id'"); + $result = db_query("SELECT * FROM locales WHERE lid = '$lid'"); if ($translation = db_fetch_object($result)) { $form .= form_item(t("Original text"), "
". wordwrap(check_output($translation->string)) ."
"); foreach ($languages as $code=>$language) $form .= (strlen($translation->string) > 30) ? form_textarea($language, $code, $translation->$code, 50, 10) : form_textfield($language, $code, $translation->$code, 50, 128); - $form .= form_hidden("id", $id); $form .= form_submit("Save translations"); return form($form); @@ -104,7 +103,7 @@ function locale_overview() { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."lid\">edit localelid\">delete locale
\n"; @@ -117,7 +116,7 @@ function locale_translated($language) { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
original stringtranslated stringoperations
". check_output($locale->string) ."". check_output($locale->$language) ."id\"> edit localeid\">delete locale
". check_output($locale->string) ."". check_output($locale->$language) ."lid\"> edit localelid\">delete locale
\n"; @@ -130,7 +129,7 @@ function locale_untranslated($language) { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
stringoperations
". check_output($locale->string) ."
$locale->location
id\"> edit localeid\">delete locale
". check_output($locale->string) ."
$locale->location
lid\"> edit localelid\">delete locale
\n"; @@ -138,9 +137,9 @@ function locale_untranslated($language) { } function locale_seek() { - global $edit, $languages, $op, $locale_settings; + global $id, $edit, $languages, $op, $locale_settings; - if ($edit[id] && session_is_registered("locale_settings")) { + if (session_is_registered("locale_settings")) { $edit = $locale_settings; } @@ -173,7 +172,7 @@ function locale_seek() { $output .= "\n"; $output .= " \n"; while ($locale = db_fetch_object($result)) { - $output .= " "; + $output .= " "; } $output .= "
stringlanguagesoperations
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."id\">edit localeid\">delete locale
". check_output($locale->string) ."
". check_output($locale->location) ."
". check_output(locale_languages($locale)) ."lid\">edit localelid\">delete locale
\n"; } @@ -232,11 +231,11 @@ function locale_admin() { function locale($string) { global $locale; if (variable_get("locale", 0)) { - $result = db_query("SELECT id, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0"); + $result = db_query("SELECT lid, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0"); if ($translation = db_fetch_object($result)) $string = ($translation->$locale) ? check_output($translation->$locale) : $string; else db_query("INSERT INTO locales (string, location) VALUES ('". addslashes($string) ."', '". check_input(getenv("REQUEST_URI")) ."')"); } return $string; } -?> \ No newline at end of file +?> diff --git a/modules/rating.module b/modules/rating.module index 062f89f5b..dd00aafb9 100644 --- a/modules/rating.module +++ b/modules/rating.module @@ -39,7 +39,7 @@ function rating_cron() { $r2 = db_query("SELECT uid FROM users ORDER BY rating DESC"); while ($account = db_fetch_object($r2)) { - db_query("INSERT INTO rating (userid, new, old) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')"); + db_query("INSERT INTO rating (uid, new, old) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')"); } } } @@ -81,7 +81,7 @@ function rating_gravity($id) { } function rating_list($limit) { - $result = db_query("SELECT u.rating, u.name, u.uid, r.* FROM users u LEFT JOIN rating r ON u.uid = r.userid ORDER BY u.rating DESC LIMIT $limit"); + $result = db_query("SELECT u.rating, u.name, u.uid, r.* FROM users u LEFT JOIN rating r ON u.uid = r.uid ORDER BY u.rating DESC LIMIT $limit"); $output .= "\n"; while ($account = db_fetch_object($result)) { diff --git a/modules/watchdog.module b/modules/watchdog.module index a98ebb550..ad7724030 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -33,13 +33,13 @@ function watchdog_overview($type) { $color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C"); $query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'"); - $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.userid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000"); + $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000"); $output .= "
\n"; $output .= " \n"; while ($watchdog = db_fetch_object($result)) { if ($background = $color[$watchdog->type]) { - $output .= " \n"; + $output .= " \n"; } } $output .= "
datemessageuseroperations
". format_date($watchdog->timestamp, "small") ."". substr(check_output($watchdog->message), 0, 64) ."". format_name($watchdog) ."id\">details
". format_date($watchdog->timestamp, "small") ."". substr(check_output($watchdog->message), 0, 64) ."". format_name($watchdog) ."wid\">details
\n"; @@ -48,7 +48,7 @@ function watchdog_overview($type) { } function watchdog_view($id) { - $result = db_query("SELECT l.*, u.name, u.uid FROM watchdog l LEFT JOIN users u ON l.userid = u.uid WHERE l.id = '$id'"); + $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = '$id'"); if ($watchdog = db_fetch_object($result)) { $output .= "\n"; diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index a98ebb550..ad7724030 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -33,13 +33,13 @@ function watchdog_overview($type) { $color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C"); $query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'"); - $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.userid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000"); + $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000"); $output .= "
\n"; $output .= " \n"; while ($watchdog = db_fetch_object($result)) { if ($background = $color[$watchdog->type]) { - $output .= " \n"; + $output .= " \n"; } } $output .= "
datemessageuseroperations
". format_date($watchdog->timestamp, "small") ."". substr(check_output($watchdog->message), 0, 64) ."". format_name($watchdog) ."id\">details
". format_date($watchdog->timestamp, "small") ."". substr(check_output($watchdog->message), 0, 64) ."". format_name($watchdog) ."wid\">details
\n"; @@ -48,7 +48,7 @@ function watchdog_overview($type) { } function watchdog_view($id) { - $result = db_query("SELECT l.*, u.name, u.uid FROM watchdog l LEFT JOIN users u ON l.userid = u.uid WHERE l.id = '$id'"); + $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = '$id'"); if ($watchdog = db_fetch_object($result)) { $output .= "\n"; -- cgit v1.2.3