alecpl
2011-05-20 7786ba1adb415fc8fd4478380d7201702a799483
program/include/rcube_user.php
@@ -5,7 +5,7 @@
 | program/include/rcube_user.inc                                        |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2010, Roundcube Dev. - Switzerland                 |
 | Copyright (C) 2005-2010, The Roundcube Dev Team                       |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -154,7 +154,7 @@
        $this->language = $_SESSION['language'];
        if ($this->db->affected_rows()) {
        if ($this->db->affected_rows() !== false) {
            $config->set_user_prefs($a_user_prefs);
            $this->data['preferences'] = $save_prefs;
            return true;
@@ -288,7 +288,7 @@
        // we'll not delete last identity
        if ($sql_arr['ident_count'] <= 1)
            return false;
            return -1;
        $this->db->query(
            "UPDATE ".get_table_name('identities').
@@ -358,8 +358,11 @@
    {
        $dbh = rcmail::get_instance()->get_dbh();
        // use BINARY (case-sensitive) comparison on MySQL, other engines are case-sensitive
        $mod = preg_match('/^mysql/', $dbh->db_provider) ? 'BINARY' : '';
        // query for matching user name
        $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = ?";
        $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = $mod ?";
        $sql_result = $dbh->query(sprintf($query, 'username'), $host, $user);
        // query for matching alias