Commit 7dd24bec authored by Dries's avatar Dries

- SQL query maintenance: '%d' -> %d.

parent c2fcb6d5
...@@ -173,10 +173,10 @@ function _locale_import_po($file, $lang, $mode) { ...@@ -173,10 +173,10 @@ function _locale_import_po($file, $lang, $mode) {
// Get the plural formula // Get the plural formula
if ($hdr["Plural-Forms"] && $p = _locale_import_parse_plural_forms($hdr["Plural-Forms"], $file->filename)) { if ($hdr["Plural-Forms"] && $p = _locale_import_parse_plural_forms($hdr["Plural-Forms"], $file->filename)) {
list($nplurals, $plural) = $p; list($nplurals, $plural) = $p;
db_query("UPDATE {locales_meta} SET plurals = '%d', formula = '%s' WHERE locale = '%s'", $nplurals, $plural, $lang); db_query("UPDATE {locales_meta} SET plurals = %d, formula = '%s' WHERE locale = '%s'", $nplurals, $plural, $lang);
} }
else { else {
db_query("UPDATE {locales_meta} SET plurals = '%d', formula = '%s' WHERE locale = '%s'", 0, '', $lang); db_query("UPDATE {locales_meta} SET plurals = %d, formula = '%s' WHERE locale = '%s'", 0, '', $lang);
} }
} }
else { else {
......
...@@ -187,13 +187,13 @@ function contact_admin_edit($cid = NULL) { ...@@ -187,13 +187,13 @@ function contact_admin_edit($cid = NULL) {
} }
if (!form_get_errors()) { if (!form_get_errors()) {
db_query("DELETE FROM {contact} WHERE cid = '%d'", $cid); db_query("DELETE FROM {contact} WHERE cid = %d", $cid);
db_query("INSERT INTO {contact} (category, recipients, reply) VALUES ('%s', '%s', '%s')", $edit['category'], $edit['recipients'], $edit['reply']); db_query("INSERT INTO {contact} (category, recipients, reply) VALUES ('%s', '%s', '%s')", $edit['category'], $edit['recipients'], $edit['reply']);
drupal_goto('admin/contact'); drupal_goto('admin/contact');
} }
} }
else { else {
$category = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = '%d'", $cid)); $category = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid));
$edit['cid'] = $category->cid; $edit['cid'] = $category->cid;
$edit['category'] = $category->category; $edit['category'] = $category->category;
$edit['recipients'] = $category->recipients; $edit['recipients'] = $category->recipients;
...@@ -209,7 +209,7 @@ function contact_admin_edit($cid = NULL) { ...@@ -209,7 +209,7 @@ function contact_admin_edit($cid = NULL) {
} }
function contact_admin_delete($cid) { function contact_admin_delete($cid) {
$info = db_fetch_object(db_query("SELECT cid, category FROM {contact} WHERE cid = '%d'",$cid)); $info = db_fetch_object(db_query("SELECT cid, category FROM {contact} WHERE cid = %d",$cid));
if ($_POST['op'] != t('Delete')) { if ($_POST['op'] != t('Delete')) {
return confirm_form('contact_admin_delete', array(), return confirm_form('contact_admin_delete', array(),
t('Are you sure you want to delete %category?', array('%category' => theme('placeholder', $info->category))), t('Are you sure you want to delete %category?', array('%category' => theme('placeholder', $info->category))),
...@@ -219,7 +219,7 @@ function contact_admin_delete($cid) { ...@@ -219,7 +219,7 @@ function contact_admin_delete($cid) {
t('Cancel')); t('Cancel'));
} }
else { else {
db_query("DELETE FROM {contact} WHERE cid = '%d'", $cid); db_query("DELETE FROM {contact} WHERE cid = %d", $cid);
drupal_goto('admin/contact'); drupal_goto('admin/contact');
} }
} }
......
...@@ -187,13 +187,13 @@ function contact_admin_edit($cid = NULL) { ...@@ -187,13 +187,13 @@ function contact_admin_edit($cid = NULL) {
} }
if (!form_get_errors()) { if (!form_get_errors()) {
db_query("DELETE FROM {contact} WHERE cid = '%d'", $cid); db_query("DELETE FROM {contact} WHERE cid = %d", $cid);
db_query("INSERT INTO {contact} (category, recipients, reply) VALUES ('%s', '%s', '%s')", $edit['category'], $edit['recipients'], $edit['reply']); db_query("INSERT INTO {contact} (category, recipients, reply) VALUES ('%s', '%s', '%s')", $edit['category'], $edit['recipients'], $edit['reply']);
drupal_goto('admin/contact'); drupal_goto('admin/contact');
} }
} }
else { else {
$category = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = '%d'", $cid)); $category = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid));
$edit['cid'] = $category->cid; $edit['cid'] = $category->cid;
$edit['category'] = $category->category; $edit['category'] = $category->category;
$edit['recipients'] = $category->recipients; $edit['recipients'] = $category->recipients;
...@@ -209,7 +209,7 @@ function contact_admin_edit($cid = NULL) { ...@@ -209,7 +209,7 @@ function contact_admin_edit($cid = NULL) {
} }
function contact_admin_delete($cid) { function contact_admin_delete($cid) {
$info = db_fetch_object(db_query("SELECT cid, category FROM {contact} WHERE cid = '%d'",$cid)); $info = db_fetch_object(db_query("SELECT cid, category FROM {contact} WHERE cid = %d",$cid));
if ($_POST['op'] != t('Delete')) { if ($_POST['op'] != t('Delete')) {
return confirm_form('contact_admin_delete', array(), return confirm_form('contact_admin_delete', array(),
t('Are you sure you want to delete %category?', array('%category' => theme('placeholder', $info->category))), t('Are you sure you want to delete %category?', array('%category' => theme('placeholder', $info->category))),
...@@ -219,7 +219,7 @@ function contact_admin_delete($cid) { ...@@ -219,7 +219,7 @@ function contact_admin_delete($cid) {
t('Cancel')); t('Cancel'));
} }
else { else {
db_query("DELETE FROM {contact} WHERE cid = '%d'", $cid); db_query("DELETE FROM {contact} WHERE cid = %d", $cid);
drupal_goto('admin/contact'); drupal_goto('admin/contact');
} }
} }
......
...@@ -97,7 +97,7 @@ function poll_execute(&$node) { ...@@ -97,7 +97,7 @@ function poll_execute(&$node) {
$node->choice = array_values($node->choice); $node->choice = array_values($node->choice);
$node->teaser = poll_teaser($node); $node->teaser = poll_teaser($node);
} }
/** /**
* Implementation of hook_validate(). * Implementation of hook_validate().
*/ */
......
...@@ -97,7 +97,7 @@ function poll_execute(&$node) { ...@@ -97,7 +97,7 @@ function poll_execute(&$node) {
$node->choice = array_values($node->choice); $node->choice = array_values($node->choice);
$node->teaser = poll_teaser($node); $node->teaser = poll_teaser($node);
} }
/** /**
* Implementation of hook_validate(). * Implementation of hook_validate().
*/ */
......
...@@ -851,7 +851,7 @@ function user_login($edit = array(), $msg = '') { ...@@ -851,7 +851,7 @@ function user_login($edit = array(), $msg = '') {
watchdog('user', t('Session opened for %name.', array('%name' => theme('placeholder', $user->name)))); watchdog('user', t('Session opened for %name.', array('%name' => theme('placeholder', $user->name))));
// Update the user table timestamp noting user has logged in. // Update the user table timestamp noting user has logged in.
db_query("UPDATE {users} SET login = '%d' WHERE uid = '%s'", time(), $user->uid); db_query("UPDATE {users} SET login = %d WHERE uid = '%s'", time(), $user->uid);
user_module_invoke('login', $edit, $user); user_module_invoke('login', $edit, $user);
...@@ -1029,7 +1029,7 @@ function user_pass_reset($uid, $timestamp, $hashed_pass) { ...@@ -1029,7 +1029,7 @@ function user_pass_reset($uid, $timestamp, $hashed_pass) {
watchdog('user', t('One time login URL used for %name with timestamp %timestamp.', array('%name' => "<em>$account->name</em>", '%timestamp' => $timestamp))); watchdog('user', t('One time login URL used for %name with timestamp %timestamp.', array('%name' => "<em>$account->name</em>", '%timestamp' => $timestamp)));
// Update the user table noting user has logged in. // Update the user table noting user has logged in.
// And this also makes this hashed password a one-time-only login. // And this also makes this hashed password a one-time-only login.
db_query("UPDATE {users} SET login = '%d' WHERE uid = %d", time(), $account->uid); db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $account->uid);
// Now we can set the new user. // Now we can set the new user.
$user = $account; $user = $account;
// And proceed with normal login, going to user page. // And proceed with normal login, going to user page.
......
...@@ -851,7 +851,7 @@ function user_login($edit = array(), $msg = '') { ...@@ -851,7 +851,7 @@ function user_login($edit = array(), $msg = '') {
watchdog('user', t('Session opened for %name.', array('%name' => theme('placeholder', $user->name)))); watchdog('user', t('Session opened for %name.', array('%name' => theme('placeholder', $user->name))));
// Update the user table timestamp noting user has logged in. // Update the user table timestamp noting user has logged in.
db_query("UPDATE {users} SET login = '%d' WHERE uid = '%s'", time(), $user->uid); db_query("UPDATE {users} SET login = %d WHERE uid = '%s'", time(), $user->uid);
user_module_invoke('login', $edit, $user); user_module_invoke('login', $edit, $user);
...@@ -1029,7 +1029,7 @@ function user_pass_reset($uid, $timestamp, $hashed_pass) { ...@@ -1029,7 +1029,7 @@ function user_pass_reset($uid, $timestamp, $hashed_pass) {
watchdog('user', t('One time login URL used for %name with timestamp %timestamp.', array('%name' => "<em>$account->name</em>", '%timestamp' => $timestamp))); watchdog('user', t('One time login URL used for %name with timestamp %timestamp.', array('%name' => "<em>$account->name</em>", '%timestamp' => $timestamp)));
// Update the user table noting user has logged in. // Update the user table noting user has logged in.
// And this also makes this hashed password a one-time-only login. // And this also makes this hashed password a one-time-only login.
db_query("UPDATE {users} SET login = '%d' WHERE uid = %d", time(), $account->uid); db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $account->uid);
// Now we can set the new user. // Now we can set the new user.
$user = $account; $user = $account;
// And proceed with normal login, going to user page. // And proceed with normal login, going to user page.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment