Exemple #1
0
 /**
  * Returns the message for the specified items id.
  */
 public function getEmailMessage($groupwareEmailItemsId, $userId)
 {
     $groupwareEmailItemsId = (int) $groupwareEmailItemsId;
     if ($groupwareEmailItemsId <= 0) {
         return 0;
     }
     $adapter = Conjoon_Db_Table::getDefaultAdapter();
     $select = $adapter->select()->from(array('items' => Conjoon_Db_Table::getTablePrefix() . 'groupware_email_items'), array('id', 'cc', 'bcc', 'reply_to', 'to', 'subject', 'from', 'date', 'content_text_plain AS body', '(1) AS is_plain_text', 'groupware_email_folders_id'))->join(array('folders_users' => Conjoon_Db_Table::getTablePrefix() . 'groupware_email_folders_users'), '`folders_users`.`groupware_email_folders_id` = `items`.`groupware_email_folders_id` ' . ' AND ' . $adapter->quoteInto('`folders_users`.`users_id`=?', $userId, 'INTEGER') . ' AND ' . $adapter->quoteInto('`folders_users`.`relationship`=?', 'owner', 'STRING'), array())->joinLeft(array('flag' => Conjoon_Db_Table::getTablePrefix() . 'groupware_email_items_flags'), '`flag`.`groupware_email_items_id` = `items`.`id`' . ' AND ' . $adapter->quoteInto('`flag`.`user_id`=?', $userId, 'INTEGER'), array('is_spam'))->where('items.id=?', $groupwareEmailItemsId);
     $row = $adapter->fetchRow($select);
     if (!$row) {
         return null;
     }
     /**
      * @see Conjoon_Modules_Groupware_Email_Folder_Model_Folder
      */
     require_once 'Conjoon/Modules/Groupware/Email/Folder/Model/Folder.php';
     $folderModel = new Conjoon_Modules_Groupware_Email_Folder_Model_Folder();
     // unique id. Underscore needed since this wil automatically get
     // camelized later on
     $row['u_id'] = $row['id'];
     $row['path'] = $folderModel->getPathForFolderId($row['groupware_email_folders_id']);
     return $row;
 }
Exemple #2
0
 /**
  * Sets the table prefix.
  *
  * @param String $prefix
  */
 public static function setTablePrefix($prefix)
 {
     self::$_tblPrefix = $prefix;
 }
Exemple #3
0
require_once 'HTMLPurifier/Bootstrap.php';
/**
 * @see HTMLPurifier.autoload
 */
/*@IGNORE*/
require_once 'HTMLPurifier.autoload.php';
// +------------------------------------------------------------------------
// | CACHING
// +------------------------------------------------------------------------
/**
 * @see Conjoon_Cache_Factory
 */
require_once 'Conjoon/Cache/Factory.php';
$mdCache = Conjoon_Cache_Factory::getCache(Conjoon_Keys::CACHE_DB_METADATA, $config->toArray());
if ($mdCache) {
    Conjoon_Db_Table::setDefaultMetadataCache($mdCache);
}
// set up authentication storage
$auth = Zend_Auth::getInstance();
//set session storage
$storage = new Zend_Auth_Storage_Session(Conjoon_Keys::SESSION_AUTH_NAMESPACE);
$auth->setStorage($storage);
Zend_Registry::set(Conjoon_Keys::REGISTRY_AUTH_OBJECT, $auth);
// +----------------------------------------------------------------------------
// | Localization
// +----------------------------------------------------------------------------
// set the default timezone here
// if the configured timezone is not valid, we will gracefully
// fall back to $LOCALE_DEFAULT_TIMEZONE as the default timezone,
// which was configured during the installation process
$tz = $config->application->locale->date->timezone;
 public function getConnection()
 {
     if ($this->myDConn) {
         return $this->myDConn;
     }
     $dbTestSettings = parse_ini_file(dirname(__FILE__) . '/../dbunit.test.properties');
     // the connection configuration
     $dbParams = array('driver' => 'pdo_mysql', 'host' => $dbTestSettings['host'], 'user' => $dbTestSettings['user'], 'password' => $dbTestSettings['password'], 'dbname' => $dbTestSettings['database'], 'port' => $dbTestSettings['port'], 'driver_options' => array(\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'));
     $cache = new \Doctrine\Common\Cache\ArrayCache();
     $config = new Configuration();
     $config->setMetadataCacheImpl($cache);
     $config->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\YamlDriver(array('Conjoon\\Data\\Orm\\Entity' => dirname(__FILE__) . '/../../../../../src/www/application/orm')));
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir(dirname(__FILE__) . '/../../../../../src/corelib/php/library/Conjoon/Data/Entity/Proxy');
     $config->setProxyNamespace('\\Conjoon\\Data\\Entity\\Proxy');
     $config->setAutoGenerateProxyClasses(false);
     $this->_entityManager = EntityManager::create($dbParams, $config);
     // set as default adapter for all db operations
     \Conjoon_Db_Table::setDefaultAdapter(\Zend_Db::factory('pdo_mysql', array('host' => $dbTestSettings['host'], 'username' => $dbTestSettings['user'], 'password' => $dbTestSettings['password'], 'dbname' => $dbTestSettings['database'], 'port' => $dbTestSettings['port'], 'driver_options' => array(\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'))));
     $pdo = new \PDO("mysql:" . "host=" . $dbTestSettings['host'] . ";" . "dbname=" . $dbTestSettings['database'] . ";" . "port=" . $dbTestSettings['port'], $dbTestSettings['user'], $dbTestSettings['password']);
     $this->myDConn = $this->createDefaultDBConnection($pdo, $dbTestSettings['database']);
     return $this->myDConn;
 }