Index: single_login.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/single_login/single_login.module,v
retrieving revision 1.3.2.1
diff -u -p -r1.3.2.1 single_login.module
--- single_login.module	1 Apr 2009 15:32:35 -0000	1.3.2.1
+++ single_login.module	1 Apr 2009 16:11:57 -0000
@@ -61,14 +61,14 @@ function single_login_init() {
       if (db_fetch_object($result)) {
         // if the current user is not the only logged with this account
         $sql = "INSERT INTO {single_login} (uid, counter) VALUES (%d, %d) ON DUPLICATE KEY UPDATE counter = counter + 1";
-        db_query(sprintf($sql, $user->uid, 1));
+        db_query($sql, $user->uid, 1);
         
-        $sql = "DELETE FROM {sessions} WHERE uid = %d AND sid != '%s'";
-        db_query(sprintf($sql, $user->uid, session_id()));
+        $sql = "DELETE FROM {sessions} WHERE uid = %d AND sid <> '%s'";
+        db_query($sql, $user->uid, session_id());
       }
       else {
         // if current user is the only who logged in with current account
-        db_query(sprintf("DELETE FROM {single_login} WHERE uid = %d", $account->uid));
+        db_query("DELETE FROM {single_login} WHERE uid = %d", $account->uid);
       }
     }
     
@@ -84,7 +84,7 @@ function single_login_init() {
 function single_login_menu() {
   $items = array();
   $items['admin/settings/single_login'] = array(
-    'title' => t('Single login settings'),
+    'title' => 'Single login settings',
     'description' => 'Configure the settings for single login.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('single_login_settings'),
@@ -92,14 +92,14 @@ function single_login_menu() {
     'type' => MENU_NORMAL_ITEM,
   );
   $items['admin/settings/single_login_history'] = array(
-    'title' => t('Single login session history'),
+    'title' => 'Single login session history',
     'description' => 'Browse single login session history.',
     'page callback' => 'single_login_history',
     'access arguments' => array('administer site configuration'),
     'type' => MENU_NORMAL_ITEM,
   );
   $items['single_login/blocked'] = array(
-    'title' => t('Account was blocked'),
+    'title' => 'Account was blocked',
     'page callback' => 'single_login_static_page',
     'page arguments' => array('blocked'),
     'access callback' => TRUE,
@@ -116,50 +116,50 @@ function single_login_menu() {
 function single_login_settings() {
   $form = array();
   $form['sub_main'] = array(
-    '#type'          => 'fieldset',
-    '#title'         => t('Main settings'),
-    '#collapsible'   => true,
-    '#collapsed'     => false,
+    '#type' => 'fieldset',
+    '#title' => t('Main settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
   );
   $form['sub_main'][SINGLE_LOGIN_CHECK_ROLES] = array(
-    '#title'         => t('Check login for roles'),
-    '#type'      => 'select',
-    '#multiple'    => true,
-    '#options'    => user_roles(),
-    '#default_value'=> variable_get(SINGLE_LOGIN_CHECK_ROLES, array()),
-    '#size'      => 10,
+    '#title' => t('Check login for roles'),
+    '#type' => 'select',
+    '#multiple' => TRUE,
+    '#options' => user_roles(),
+    '#default_value' => variable_get(SINGLE_LOGIN_CHECK_ROLES, array()),
+    '#size' => 10,
   );
   $form['sub_main'][SINGLE_LOGIN_TREAT_ONLINE] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Treat user online for seconds'),
+    '#type' => 'textfield',
+    '#title' => t('Treat user online for seconds'),
     '#default_value' => variable_get(SINGLE_LOGIN_TREAT_ONLINE, SINGLE_LOGIN_DEF_TREAT_ONLINE),
   );
   $form['sub_main'][SINGLE_LOGIN_MAX_RECONNECTIONS] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Max login ping-pong values'),
+    '#type' => 'textfield',
+    '#title' => t('Max login ping-pong values'),
     '#default_value' => variable_get(SINGLE_LOGIN_MAX_RECONNECTIONS, SINGLE_LOGIN_DEF_MAX_RECONNECTIONS),
   );
   $form['sub_main'][SINGLE_LOGIN_STORE_HISTORY] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Store sessions history for days (0 - infinite)'),
+    '#type' => 'textfield',
+    '#title' => t('Store sessions history for days (0 - infinite)'),
     '#default_value' => variable_get(SINGLE_LOGIN_STORE_HISTORY, SINGLE_LOGIN_DEF_STORE_HISTORY),
   );
   $form['sub_msg'] = array(
-    '#type'          => 'fieldset',
-    '#title'         => t('Messages settings'),
-    '#collapsible'   => true,
-    '#collapsed'     => false,
+    '#type' => 'fieldset',
+    '#title' => t('Messages settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
   );
   $form['sub_msg'][SINGLE_LOGIN_MSG_RELOGGED] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Relogin message'),
-    '#maxlength'     => 500,
+    '#type' => 'textfield',
+    '#title' => t('Relogin message'),
+    '#maxlength' => 500,
     '#default_value' => variable_get(SINGLE_LOGIN_MSG_RELOGGED, SINGLE_LOGIN_DEF_RELOGGED),
   );
   $form['sub_msg'][SINGLE_LOGIN_MSG_BLOCKED] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Account blocked message'),
-    '#maxlength'     => 500,
+    '#type' => 'textfield',
+    '#title' => t('Account blocked message'),
+    '#maxlength' => 500,
     '#default_value' => variable_get(SINGLE_LOGIN_MSG_BLOCKED, SINGLE_LOGIN_DEF_BLOCKED),
   );
   if (module_exists('googleanalytics')) {
@@ -188,10 +188,10 @@ function single_login_history_form_uid($
   $form = array();
 
   $form['uid_fieldset'] = array(
-    '#type'          => 'fieldset',
-    '#title'         => t('User history preferences'),
-    '#collapsible'   => true,
-    '#collapsed'     => false,
+    '#type' => 'fieldset',
+    '#title' => t('User history preferences'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
   );
   $form['uid_fieldset']['history_for_uid'] = array(
     '#type' => 'textfield',
@@ -223,7 +223,8 @@ function single_login_history_form_uid_s
     if ($res) {
       $id = $res;
     }
-  } else {
+  }
+  else {
     $id = intval($values['history_for_uid']);
     $name = '';
 
@@ -248,7 +249,8 @@ function single_login_history_form_list(
 
   if (!db_result($result)) {
     $form['head']['#description'] = t('History for this user is empty');
-  } else {
+  }
+  else {
     $rows = array();
     while ($row = db_fetch_object($result)) {
       $rows[] = array($row->history_id, date("d.m.Y G:i", $row->date), $row->ip, $row->browser);
@@ -291,7 +293,7 @@ function single_login_user($op, &$edit, 
           $sql = "INSERT INTO {single_login} (uid, counter) VALUES (%d, %d) ON DUPLICATE KEY UPDATE counter = counter + 1";
           db_query($sql, $account->uid, 1);
           
-          $sql = "DELETE FROM {sessions} WHERE uid = %d AND sid != '%s'";
+          $sql = "DELETE FROM {sessions} WHERE uid = %d AND sid <> '%s'";
           db_query($sql, $account->uid, session_id());
         }
         else {
@@ -302,7 +304,7 @@ function single_login_user($op, &$edit, 
 
         $sql = "SELECT counter FROM {single_login} WHERE uid = %d";
         $res = db_query($sql, $account->uid);
-        $ping_pong_val = (($row = db_fetch_object($res)) === false) ? 0 : $row->counter;
+        $ping_pong_val = (($row = db_fetch_object($res)) === FALSE) ? 0 : $row->counter;
         if ($ping_pong_val >= variable_get(SINGLE_LOGIN_MAX_RECONNECTIONS, SINGLE_LOGIN_DEF_MAX_RECONNECTIONS)) {
           $sql = "UPDATE {users} SET status = 0 WHERE uid = %d";
           db_query($sql, $account->uid);
@@ -311,7 +313,7 @@ function single_login_user($op, &$edit, 
 
           user_logout();
         }
-        else if($ping_pong_val) {
+        elseif ($ping_pong_val) {
           //TODO: Clean that up and make it readable
           $relogins_left = variable_get(SINGLE_LOGIN_MAX_RECONNECTIONS, SINGLE_LOGIN_DEF_MAX_RECONNECTIONS) - $ping_pong_val;
           drupal_set_message(variable_get(SINGLE_LOGIN_MSG_RELOGGED, SINGLE_LOGIN_DEF_RELOGGED) . $relogins_left);
@@ -349,10 +351,10 @@ function _single_login_is_user_single($u
   $roles_single_login = variable_get(SINGLE_LOGIN_CHECK_ROLES, array());
 
   foreach ($user_roles as $role_id) {
-    if (in_array($role_id, $roles_single_login)) return true;
+    if (in_array($role_id, $roles_single_login)) return TRUE;
   }
 
-  return false;
+  return FALSE;
 }
 
 function _single_login_get_session_id_fid() {
