/** * * @param array $config * * @throws Conjoon_Argument_Exception */ public function __construct(array $config = array()) { Conjoon_Argument_Check::check(array(self::PATH => array('allowEmpty' => false, 'type' => 'string'), self::VARS => array('allowEmpty' => false, 'type' => 'isset')), $config); $config[self::TEMPLATE_RESOURCE] = new Conjoon_Text_Template_PhpFileResource($config[self::PATH]); $config[self::PARSE_STRATEGY] = new Conjoon_Text_Template_PhpParseStrategy(); parent::__construct($config); }
/** * @inheritdoc */ public function __construct($options) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; $data = array('messageFlagText' => $options); \Conjoon_Argument_Check::check(array('messageFlagText' => array('type' => 'string', 'allowEmpty' => false)), $data); $options = $data['messageFlagText']; /** * @see Conjoon_Text_Parser_Mail_ClientMessageFlagListParser */ require_once 'Conjoon/Text/Parser/Mail/ClientMessageFlagListParser.php'; $parser = new \Conjoon_Text_Parser_Mail_ClientMessageFlagListParser(); try { $flags = $parser->parse($options); } catch (\Conjoon_Text_Parser_Exception $e) { /** * @see Conjoon_Mail_Client_Message_Flag_ClientMessageFlagException */ require_once 'Conjoon/Mail/Client/Message/Flag/FlagException.php'; throw new FlagException("flag-string for setting message flags seems to be invalid." . "Exception thrown by previous exception: " . $e->getMessage(), 0, $e); } $this->_flags = $this->_createCollection($flags); }
/** * Allows for specifying the options * - delimiter: string, the delimiter for the Imap global name if path consists * of more than one parts * - popTail: bool, whether to return the global name without the last part, * if any. Defaults to false * * @param array $options * * @throws Conjoon_Argument_Exception if delimiter was not specified */ public function __construct(array $options = array()) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; Conjoon_Argument_Check::check(array('delimiter' => array('type' => 'string', 'allowEmpty' => false)), $options); $this->_options = $options; $this->_options['popTail'] = isset($this->_options['popTail']) ? (bool) $this->_options['popTail'] : false; }
/** * Constructs a new instance of this class. * * @param string $uId * @param bool $clear whether the flag represented by this class * should be removed, or not * * @throws Conjoon_Argument_Exception if either $meesageId or $clear * did not evaluate to the expected types. */ public function __construct($uId, $clear = false) { $data = array('uId' => $uId, 'clear' => $clear); /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; \Conjoon_Argument_Check::check(array('uId' => array('type' => 'string', 'allowEmpty' => false), 'clear' => array('type' => 'bool', 'allowEmpty' => false)), $data); $this->_uId = $data['uId']; $this->_clear = $data['clear']; }
/** * @inherit Conjoon_Text_Transformer::transform */ public function transform($input) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; $data = array('input' => $input); Conjoon_Argument_Check::check(array('input' => array('type' => 'string', 'allowEmpty' => false)), $data); $input = $data['input']; $regex = '/(\\(.*\\))$/'; $str = preg_replace($regex, "", $input); return trim($str); }
/** * returns the callback url for the oauth service based on the specified * arguments. * * @param array $config * * @returns string * * @throws Conjoon_Argument_Exception */ public function getOauthCallbackUrl(array $config) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; Conjoon_Argument_Check::check(array('host' => array('type' => 'string', 'allowEmpty' => false), 'port' => array('type' => 'int', 'allowEmpty' => false, 'greaterThan' => 0), 'protocol' => array('type' => 'string', 'allowEmpty' => false), 'baseUrl' => array('type' => 'string', 'allowEmpty' => false), 'oauthCallbackUrl' => array('type' => 'string', 'allowEmpty' => false)), $config); $port = $config['port']; $protocol = $config['protocol']; $host = $config['host']; $baseUrl = $config['baseUrl']; $oauthCallbackUrl = $config['oauthCallbackUrl']; $host = trim($host, '/'); $baseUrl = trim($baseUrl, '/'); $callbackUrl = ltrim($oauthCallbackUrl, '/'); $baseUrl = $baseUrl == '' ? '/' : '/' . $baseUrl . '/'; return $protocol . '://' . $host . ':' . $port . $baseUrl . $callbackUrl; }
/** * @inherit Conjoon_Text_Parser::parse */ public function parse($input) { $data = array('input' => $input); /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; Conjoon_Argument_Check::check(array('input' => array('type' => 'string', 'allowEmpty' => false)), $data); $input = $data['input']; $parts = @json_decode($input, true); if ($parts === null) { /** * @see Conjoon_Text_Parser_Exception */ require_once 'Conjoon/Text/Parser/Exception.php'; throw new Conjoon_Text_Parser_Exception("Could not decode \"{$input}\". No valid json?"); } return $parts; }
/** * * @param array $config * * @throws Conjoon_Argument_Exception */ public function __construct(array $config = array()) { Conjoon_Argument_Check::check(array(self::TEMPLATE_RESOURCE => array('allowEmpty' => false, 'type' => 'instanceof', 'class' => 'Conjoon_Text_Template_Resource'), self::VARS => array('allowEmpty' => false, 'type' => 'isset')), $config); if (isset($config[self::PARSE_STRATEGY])) { if (!$config[self::PARSE_STRATEGY] instanceof Conjoon_Text_ParseStrategy) { /** * @see Conjoon_Argument_Exception */ require_once 'Conjoon/Argument/Exception.php'; throw new Conjoon_Argument_Exception('parseStrategy must be of type "Conjoon_Text_ParseStrategy"'); } } $this->_vars = $config[self::VARS]; $this->_templateResource = $config[self::TEMPLATE_RESOURCE]; if (isset($config[self::PARSE_STRATEGY])) { $this->_parseStrategy = $config[self::PARSE_STRATEGY]; } else { $this->_parseStrategy = $this->_getDefaultParseStrategy(); } }
protected function _moveOrCopyLob(array $data, $type) { Conjoon_Argument_Check::check(array('from' => array('type' => 'string'), 'to' => array('type' => 'string'), 'name' => array('type' => 'string')), $data); $from = $this->_sanitizePath($data['from']); $to = $this->_sanitizePath($data['to']); $name = $data['name']; if (!@file_exists($from)) { throw new Conjoon_Data_Exception("File \"{$from}\" does not seem to exist or is not readable."); } if (!@is_dir($to)) { throw new Conjoon_Data_Exception("Path \"{$to}\" does not seem to exist or is not a directory."); } $finalPath = $to . '/' . $name; if (@file_exists($finalPath)) { throw new Conjoon_Data_Exception("File \"{$finalPath}\" already exists."); } if ($type === self::OP_COPY) { $succ = @copy($from, $finalPath); } else { if ($type === self::OP_MOVE) { $succ = @rename($from, $finalPath); } else { throw new Conjoon_Data_Exception("Unknown operation type - \"{$type}\"."); } } if ($succ === false) { return null; } return $finalPath; }
/** * Returns the relationship for the specified folder and user. * * @param integer $folderId * @param integer $userId * * @return string or null * * @throws Conjoon_ArgumentException */ public function getRelationShipForFolderAndUser($folderId, $userId) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; $data = array('folderId' => $folderId, 'userId' => $userId); Conjoon_Argument_Check::check(array('folderId' => array('type' => 'int', 'allowEmpty' => false), 'userId' => array('type' => 'int', 'allowEmpty' => false)), $data); $folderId = $data['folderId']; $userId = $data['userId']; $select = $this->select()->from($this, array('relationship'))->where($this->getAdapter()->quoteInto('groupware_email_folders_id = ?', $folderId, 'INTEGER'))->where($this->getAdapter()->quoteInto('users_id = ?', $userId, 'INTEGER')); $row = $this->fetchRow($select); if (!$row) { return null; } return $row->relationship == 'owner' ? self::OWNER : null; }
/** * Returns the complete lob data for the specified id and key. * The properties key and id have to be set in the passed array. * * @param array $data * * @return array|null If a call to this method is successfull, the * returned property "resource" will be set with the lob's content * * @throws Conjoon_Data_Exception */ public function getLobContentWithData(array $data) { Conjoon_Argument_Check::check(array('id' => array('type' => 'int'), 'key' => array('type' => 'string')), $data); $lobData = $this->_dbLobAccess->getLobData($data); if (!$lobData || empty($lobData)) { return null; } if (!array_key_exists('storage_container', $lobData)) { throw new Conjoon_Data_Exception("Property \"storage_container\" not available in fetched lob data"); } if ($lobData['storage_container']) { $storageBasePath = $this->_getLobStorageBasePath(); if ($storageBasePath === null) { return null; } $assumedDir = $this->_getLobStorageBasePath() . '/' . $lobData['storage_container']; $file = $assumedDir . '/' . $this->_generateFileNameStringForLob($lobData); $fc = $this->_fileLobAccess->getLobContent(array('path' => $file)); if ($fc === null) { return null; } Conjoon_Util_Array::apply($lobData, array('resource' => $fc)); return $lobData; } return $lobData; }
/** * @inherit Conjoon_Text_Transformer::transform */ public function transform($input) { $data = array('input' => $input); /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; Conjoon_Argument_Check::check(array('input' => array('allowEmpty' => true, 'type' => 'string')), $data); $value = $data['input']; if ($value === "") { return ""; } $bid = '?q?'; $q = stripos($value, '?q?'); if ($q === false) { $q = stripos($value, '?b?'); if ($q === false) { return $value; } $bid = '?b?'; } $ms = array(trim($value)); $usedSpace = false; if (strpos($value, "\r\n") !== false) { $ms = explode("\r\n", $value); } else { if (strpos($value, "\r") !== false) { $ms = explode("\r", $value); } else { if (strpos($value, "\n") !== false) { $ms = explode("\n", $value); } else { if (strpos(trim($value), " ") !== false) { $usedSpace = true; $ms = explode(" ", trim($value)); } } } } $len = count($ms); $spec = ""; if ($len > 1) { $index = -1; for ($i = 0; $i < $len; $i++) { $ms[$i] = $ms[$i]; if (stripos($ms[$i], $bid) !== false) { if (strpos($ms[$i], '=') === 0) { $spec = ' '; } else { $fo = strpos($ms[$i], '='); $old = $ms[$i]; $ms[$i] = substr($ms[$i], 0, $fo); array_push($ms, substr($old, $fo)); } break; } $index = $i; } if ($index != -1) { $spec = implode(" ", array_slice($ms, 0, $index + 2)) . $spec; $ms = array_slice($ms, $index + 2); } $ms[0] = substr($ms[0], 0, -2); $chId = substr($ms[0], 0, $q + 3); for ($i = 1, $len_i = count($ms); $i < $len_i; $i++) { $f = strrpos($ms[$i], '?='); if ($f != false) { $ms[$i] = trim($ms[$i]); } if ($ms[$i] == "") { continue; } $ms[$i] = str_replace($chId, "", $ms[$i]); if ($f !== false) { $ms[$i] = substr($ms[$i], 0, -2); } } $tmp = array_shift($ms); $ms = $tmp . ($usedSpace ? "" : "") . implode($usedSpace ? " " : "", $ms) . '?='; } else { $ms = implode("", $ms); } $s = preg_replace_callback("/=(\\d[a-f]|[a-f]{0,2}|[[:xdigit:]])/", array($this, "strtoupperCallback"), $ms); $oldEncodings = array('input_encoding' => iconv_get_encoding('input_encoding'), 'output_encoding' => iconv_get_encoding('output_encoding'), 'internal_encoding' => iconv_get_encoding('internal_encoding')); iconv_set_encoding('input_encoding', 'UTF-8'); iconv_set_encoding('output_encoding', 'UTF-8'); iconv_set_encoding('internal_encoding', 'UTF-8'); $ret = @iconv_mime_decode_headers('A: ' . $s); if (!is_array($ret) || is_array($ret) && !isset($ret['A'])) { $delimPos = stripos($s, $bid); $mimeChar = strtolower(substr($s, 2, $delimPos - 2)); @iconv_set_encoding('internal_encoding', $mimeChar); $ret = @iconv_mime_decode_headers('A: ' . $s); } iconv_set_encoding('input_encoding', $oldEncodings['input_encoding']); iconv_set_encoding('output_encoding', $oldEncodings['output_encoding']); iconv_set_encoding('internal_encoding', $oldEncodings['internal_encoding']); if (!is_array($ret) || is_array($ret) && !isset($ret['A'])) { return $value; } return trim($spec . $ret['A']); }
/** * @inherit Conjoon_Text_Parser::parse */ public function parse($input) { $data = array('header' => $input); /** * @see Conjoon_Text_Parser_Exception */ require_once 'Conjoon/Text/Parser/Exception.php'; /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; Conjoon_Argument_Check::check(array('header' => array('allowEmpty' => false, 'type' => 'string')), $data); $this->_setIconvEncoding(self::ICONV_UTF_8); $message = new Conjoon_Mail_Message(array('headers' => $data['header'], 'noToplines' => true, 'body' => 'dummy')); $emailItem = array(); $messageId = ""; try { $messageId = $message->messageId; } catch (Zend_Mail_Exception $e) { // ignore } $emailItem['messageId'] = $messageId; try { $emailItem['from'] = $message->from; } catch (Zend_Mail_Exception $e) { // may be changed to localized header values by anti vir programs try { $emailItem['from'] = $message->von; } catch (Zend_Mail_Exception $e) { $emailItem['from'] = "-"; } } if (!isset($emailItem['from'])) { $this->_setIconvEncoding(self::ICONV_OLD); throw new Conjoon_Text_Parser_Exception("No header with the name \"from\" found."); } $emailItem['subject'] = ""; // very few emails will come in without a subject. try { $emailItem['subject'] = $message->subject; } catch (Zend_Mail_Exception $e) { try { // may be changed to localized header values by anti vir programs $emailItem['subject'] = $message->betreff; } catch (Zend_Mail_exception $e) { // ignore } } catch (Zend_Mail_exception $e) { // ignore } $emailItem['date'] = ""; // date field will be given presedence try { $emailItem['date'] = $message->date; } catch (Zend_Mail_Exception $e) { // ignore } // if date not found, look up deliveryDate if (!$emailItem['date']) { try { $emailItem['date'] = $message->deliveryDate; } catch (Zend_Mail_Exception $e) { // ignore } if (!$emailItem['date']) { try { // may be changed to localized header values by anti vir programs $emailItem['date'] = $message->datum; } catch (Zend_Mail_Exception $e) { // ignore } // and one further down to fall back to actual // date if none was found if (!$emailItem['date']) { /** * @see Zend_Date */ require_once 'Zend/Date.php'; $zd = new Zend_Date(); $emailItem['date'] = $zd->get(Zend_Date::RFC_2822); } } } try { $emailItem['to'] = $message->to; } catch (Zend_Mail_Exception $e) { // "to" might not be used, instead "cc" will be probably available // then $emailItem['to'] = ""; } if (!$emailItem['to']) { try { // may be changed to localized header values by anti vir programs $emailItem['to'] = $message->an; } catch (Zend_Mail_Exception $e) { // ignore } } try { $emailItem['cc'] = $message->cc; } catch (Zend_Mail_Exception $e) { $emailItem['cc'] = ''; } try { $emailItem['references'] = $message->references; } catch (Zend_Mail_Exception $e) { $emailItem['references'] = ''; } try { $emailItem['replyTo'] = $message->replyTo; } catch (Zend_Mail_Exception $e) { $emailItem['replyTo'] = ''; } try { $emailItem['inReplyTo'] = $message->inReplyTo; } catch (Zend_Mail_Exception $e) { $emailItem['inReplyTo'] = ''; } $this->_setIconvEncoding(self::ICONV_OLD); return $emailItem; }
/** * Ensures everything works as expected * */ public function testInt() { $tests = $this->_checks['testInt']['testFor']['success']; for ($i = 0, $len = count($tests); $i < $len; $i++) { $rule = $tests[$i][0]; $inputs = $tests[$i][1]; for ($a = 0, $lena = count($inputs); $a < $lena; $a++) { $in = array('input' => $inputs[$a]); Conjoon_Argument_Check::check($rule, $in); $this->assertSame($in['input'], (int) $inputs[$a]); } } }
/** * Queries the IMAP server and renames the folder found in the deepest level * of the path. * * @param string $name * @param array $path The parts of the path which has to be assembled using * the delimiter of the target storage * @param Conjoon_Modules_Groupware_Email_Account_Dto $account * @param integer $userId * * @return the global name of the folder is renaming was successfull, * otherwise false * * @throws Exception */ public function renameImapFolderForPath($name, array $pathParts, Conjoon_Modules_Groupware_Email_Account_Dto $account, $userId) { $data = array('pathParts' => $pathParts); Conjoon_Argument_Check::check(array('pathParts' => array('type' => 'array', 'allowEmpty' => false)), $data); $pathParts = $data['pathParts']; $userId = $this->_checkParam($userId, 'userId'); $name = $this->_checkParam($name, 'name'); $this->_checkParam($account, 'checkForImap'); /** * @see Conjoon_Modules_Groupware_Email_ImapHelper */ require_once 'Conjoon/Modules/Groupware/Email/ImapHelper.php'; $delim = Conjoon_Modules_Groupware_Email_ImapHelper::getFolderDelimiterForImapAccount($account); if (strpos($name, $delim) !== false) { throw new InvalidArgumentException("Sorry, it seems that \"{$delim}\" is reserved and may not be " . "used within the name"); } $path = $this->getAssembledGlobalNameForAccountAndPath($account, $pathParts); array_pop($pathParts); $newPath = implode($delim, $pathParts); if ($path === null || $newPath === null) { return false; } $newPath = $newPath ? $newPath . $delim . $name : $name; $protocol = Conjoon_Modules_Groupware_Email_ImapHelper::reuseImapProtocolForAccount($account); if ($protocol->rename($path, $newPath) !== true) { return false; } return $newPath; }
/** * Returns all ids of all child folders as a flat array without * hierarchy. * * @param integer $folderId * * @return array * * @throws Conjoon_Argument_Exception */ public function getChildFolderIdsAsFlatArray($folderId) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; $data = array('folderId' => $folderId); Conjoon_Argument_Check::check(array('folderId' => array('type' => 'int', 'allowEmpty' => false)), $data); $folderId = $data['folderId']; $adapter = $this->getAdapter(); $where = $adapter->quoteInto('parent_id = ?', $folderId, 'INTEGER'); $select = $this->select()->from($this, array('id'))->where($where); $rows = $adapter->fetchAll($select); $ids = array(); foreach ($rows as $row) { $ids[] = $row['id']; $tmpIds = $this->getChildFolderIdsAsFlatArray($row['id']); if (!empty($tmpIds)) { $ids = array_merge($ids, $tmpIds); } } return $ids; }
/** * Computes a file name based on the given data in $data * * @param array $data * * @return string */ protected function _generateFileNameStringForLob(array $data) { Conjoon_Argument_Check::check(array('id' => array('type' => 'int'), 'key' => array('type' => 'string')), $data); return $data['id'] . '-' . $data['key']; }
/** * Adds the lob from a stream. * - groupwareFilesFoldersId * - key * - name * - mimeType * - resource * - storageContainer * * @param array $data * * @return mixed a unique identifier for this lob, or null * * @throws Conjoon_Data_Exception * @see isStreamWritingSupported */ public function addLobFromStream(array $data) { if (!$this->isStreamWritingSupported()) { throw new Conjoon_Data_Exception("Stream writing for " . get_class(self) . " is not supported."); } Conjoon_Argument_Check::check(array('groupwareFilesFoldersId' => array('type' => 'int'), 'key' => array('type' => 'string'), 'name' => array('type' => 'string'), 'mimeType' => array('type' => 'string'), 'storageContainer' => array('type' => 'string', 'allowEmpty' => true, 'mandatory' => false, 'default' => null)), $data); if (isset($data['resource']) && !is_resource($data['resource'])) { throw new Conjoon_Exception("Passed property resource must be a resource"); } $db = self::getDefaultAdapter(); $statement = $db->prepare("INSERT INTO `" . self::getTablePrefix() . "groupware_files`\n (\n `name`,\n `mime_type`,\n `key`,\n `content`,\n `groupware_files_folders_id`,\n `storage_container`\n )\n VALUES\n (\n :name,\n :mime_type,\n :key,\n :content,\n :groupware_files_folders_id,\n :storage_container\n )"); $statement->bindParam(':key', $data['key'], PDO::PARAM_STR); $statement->bindParam(':groupware_files_folders_id', $data['groupwareFilesFoldersId'], PDO::PARAM_INT); $statement->bindParam(':name', $data['name'], PDO::PARAM_STR); $statement->bindParam(':mime_type', $data['mimeType'], PDO::PARAM_STR); $statement->bindParam(':content', $data['resource'], PDO::PARAM_LOB); $statement->bindParam(':storage_container', $data['storageContainer'], PDO::PARAM_STR); $statement->execute(); $result = $statement->rowCount(); if ($result > 0) { return $db->lastInsertId(); } return null; }
/** * @inheritdoc */ public function getRawMessage($id) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; $data = array('id' => $id); Conjoon_Argument_Check::check(array('id' => array('type' => 'integer', 'allowEmpty' => false, 'greaterThan' => 0)), $data); $id = $data['id']; try { $content = $this->_protocol->retrieve($id); return $content; } catch (Zend_Mail_Protocol_Exception $e) { /** * @see Conjoon_Mail_Service_MailServiceException */ require_once 'Conjoon/Mail/Service/MailServiceException.php'; throw new Conjoon_Mail_Service_MailServiceException("Exception thrown by previous exception: " . $e->getMessage(), 0, $e); } }
/** * @inheritdoc */ public function getHeaderListAndMetaInformationForGlobalName($globalName, $from = 1, $to = -1) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; $data = array('globalName' => $globalName); Conjoon_Argument_Check::check(array('globalName' => array('type' => 'string', 'allowEmpty' => false)), $data); $globalName = $data['globalName']; try { $this->selectFolder($globalName); } catch (Zend_Mail_Storage_Exception $e) { /** * @see Conjoon_Mail_Service_MailServiceException */ require_once 'Conjoon/Mail/Service/MailServiceException.php'; throw new Conjoon_Mail_Service_MailServiceException("Exception thrown by previous exception: " . $e->getMessage(), 0, $e); } $count = $this->countMessages(); $to = $to == -1 ? $count : $to; $headers = array(); try { $result = $this->_protocol->fetch(array('RFC822.HEADER', 'BODYSTRUCTURE', 'FLAGS', 'UID'), $from, $to); } catch (Zend_Mail_Protocol_Exception $e) { /** * @see Conjoon_Mail_Service_MailServiceException */ require_once 'Conjoon/Mail/Service/MailServiceException.php'; throw new Conjoon_Mail_Service_MailServiceException("Exception thrown by previous exception: " . $e->getMessage(), 0, $e); } foreach ($result as $tmp) { $headers[] = array('header' => $tmp['RFC822.HEADER'], 'bodystructure' => $tmp['BODYSTRUCTURE'], 'flags' => $tmp['FLAGS'], 'uid' => $tmp['UID']); } return $headers; }
/** * Returns the accounts with the specified name for the specified user * Returns an empty array if no accounts with this name could be found. * * @param string $name The name of the accounts to query * @param int $userId The id of the user to whom the specified accounts * belongs * * @return array * * @throws Conjoon_Argument_Exception */ public function getAccountWithNameForUser($name, $userId) { $d = array('name' => $name, 'userId' => $userId); /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; Conjoon_Argument_Check::check(array('name' => array('allowEmpty' => false, 'type' => 'string'), 'userId' => array('allowEmpty' => false, 'type' => 'int')), $d); $userId = $d['userId']; $name = $d['name']; $rows = $this->fetchAll($this->select()->where('user_id=?', $userId)->where('is_deleted=?', false)->where('lower(name)=?', strtolower($name))); return $rows->toArray(); }
/** * Returns the list of email items for the specified folder path for the * specified sort info. * * @param array $pathInfo Path informations as returned by using the * Conjoon_Text_Parser_Mail_MailboxFolderPathJsonParser * @param integer $userId * @param array $sortInfo An array with the following key/value pairs: * - sort => name of the header to sort after * - dir => sort direction - ASC or DESC * - limit => max number of messagesto sort * - start => starting position of message to sort * @param $additionalInfo return additionalinfo in an array. The whole * result will be available in * - items: an array of items * - totalCount: the totalCount of available items * @param integer $from return only the index within the result set * @param integer $to return only the index within the result set * * * @return array * * @throws Conjoon_Argument_Exception */ public function getEmailItemList(array $pathInfo, $userId, array $sortInfo = array(), $additionalInfo = false, $from = 1, $to = -1) { /** * @see Conjoon_Argument_Check */ require_once 'Conjoon/Argument/Check.php'; $data = array('pathInfo' => $pathInfo, 'userId' => $userId); Conjoon_Argument_Check::check(array('pathInfo' => array('type' => 'array', 'allowEmpty' => false), 'userId' => array('type' => 'int', 'allowEmpty' => false)), $data); $pathInfo = $data['pathInfo']; $userId = $data['userId']; if ($this->_getFolderFacade()->isRemoteFolder($pathInfo['rootId'])) { $accountDto = $this->_getFolderFacade()->getImapAccountForFolderIdAndUserId($pathInfo['rootId'], $userId); return $this->_getEmailItemListForAccountAndRemoteFolder($accountDto, $pathInfo, $sortInfo, $additionalInfo, $from, $to, $userId); } throw new RuntimeException("Anything but remote folder not supported by this facade yet"); }