thomascube
2009-07-01 73967c716980699b31b07032e553132986df0134
program/include/rcube_user.php
@@ -135,12 +135,12 @@
   * Get default identity of this user
   *
   * @param int  Identity ID. If empty, the default identity is returned
   * @return array Hash array with all cols of the
   * @return array Hash array with all cols of the identity record
   */
  function get_identity($id = null)
  {
    $sql_result = $this->list_identities($id ? sprintf('AND identity_id=%d', $id) : '');
    return $this->db->fetch_assoc($sql_result);
    $result = $this->list_identities($id ? sprintf('AND identity_id=%d', $id) : '');
    return $result[0];
  }
  
  
@@ -160,7 +160,12 @@
       ORDER BY ".$this->db->quoteIdentifier('standard')." DESC, name ASC, identity_id ASC",
      $this->ID);
    
    return $sql_result;
    $result = array();
    while ($sql_arr = $this->db->fetch_assoc($sql_result)) {
      $result[] = $sql_arr;
    }
    return $result;
  }
  
  
@@ -400,31 +405,36 @@
      // create new identities records
      $standard = 1;
      foreach ($email_list as $row) {
        if (is_array($row)) {
          $email = $row[0];
          $name = $row[1] ? $row[1] : $user_name;
        } else {
     $email = $row;
     $name = $user_name;
   }
        }
        else {
          $email = $row;
          $name = $user_name;
        }
        $plugin = $rcmail->plugins->exec_hook('create_identity', array('record' => array(
        $plugin = $rcmail->plugins->exec_hook('create_identity', array(
          'login' => true,
          'user_id' => $user_id,
          'name' => strip_newlines($name),
          'email' => $email,
          'standard' => $standard)));
          'record' => array(
            'user_id' => $user_id,
            'name' => strip_newlines($name),
            'email' => $email,
            'standard' => $standard,
            'signature' => '',
          ),
        ));
          
        if (!$plugin['abort'] && $plugin['record']['email']) {
          $dbh->query(
              "INSERT INTO ".get_table_name('identities')."
                (user_id, del, standard, name, email)
               VALUES (?, 0, ?, ?, ?)",
                (user_id, del, standard, name, email, signature)
               VALUES (?, 0, ?, ?, ?, ?)",
              $user_id,
              $plugin['record']['standard'],
              $plugin['record']['name'] != NULL ? $plugin['record']['name'] : '',
              $plugin['record']['email']);
              $plugin['record']['email'],
              $plugin['record']['signature']);
        }
        $standard = 0;
      }