/** * Saves virtual email address to the backend. * * @param array $info The virtual email data. * @param string $domain The name of the domain for this virtual email. * * @throws Vilma_Exception */ public function saveVirtual($info, $domain) { /* Access check (for domainkey) */ $this->getDomainByName($domain); $values = array($info['stripped_email'] . '@' . $domain, $info['virtual_destination']); if (empty($info['virtual_id'])) { $sql = 'INSERT INTO ' . $this->_params['tables']['virtuals'] . ' (' . $this->_getTableField('virtuals', 'virtual_email') . ', ' . $this->_getTableField('virtuals', 'virtual_destination') . ') VALUES (?, ?)'; $this->_db->insert($sql, $values); } else { $sql = 'UPDATE ' . $this->_params['tables']['virtuals'] . ' SET ' . $this->_getTableField('virtuals', 'virtual_email') . ' = ?, ' . $this->_getTableField('virtuals', 'virtual_destination') . ' = ?' . ' WHERE ' . $this->_getTableField('virtuals', 'virtual_id') . ' = ?'; $values[] = $info['virtual_id']; $this->_db->update($sql, $values); } }
/** * Creates a folder on the VFS. * * @param string $path Holds the path of directory to create folder. * @param string $name Holds the name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { $path = $this->_convertPath($path); if (!strlen($path)) { $path = null; } $sql = sprintf('INSERT INTO %s (vfs_type, vfs_path, vfs_name, vfs_modified, vfs_owner) VALUES (?, ?, ?, ?, ?)', $this->_params['table']); $values = array(self::FOLDER, $path, $name, time(), $this->_params['user'] ?: null); try { $this->_db->insert($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } }