| | |
| | | public $comm_path = './'; |
| | | |
| | | private $texts; |
| | | private $books = array(); |
| | | |
| | | |
| | | /** |
| | |
| | | $this->db = new rcube_mdb2($config_all['db_dsnw'], $config_all['db_dsnr'], $config_all['db_persistent']); |
| | | $this->db->sqlite_initials = INSTALL_PATH . 'SQL/sqlite.initial.sql'; |
| | | $this->db->set_debug((bool)$config_all['sql_debug']); |
| | | $this->db->db_connect('w'); |
| | | } |
| | | |
| | | return $this->db; |
| | |
| | | $ldap_config = (array)$this->config->get('ldap_public'); |
| | | $abook_type = strtolower($this->config->get('address_book_type')); |
| | | |
| | | $plugin = $this->plugins->exec_hook('get_address_book', array('id' => $id, 'writeable' => $writeable)); |
| | | $plugin = $this->plugins->exec_hook('addressbook_get', array('id' => $id, 'writeable' => $writeable)); |
| | | |
| | | // plugin returned instance of a rcube_addressbook |
| | | if ($plugin['instance'] instanceof rcube_addressbook) { |
| | |
| | | else { // $id == 'sql' |
| | | $contacts = new rcube_contacts($this->db, $this->user->ID); |
| | | } |
| | | |
| | | // add to the 'books' array for shutdown function |
| | | if (!in_array($contacts, $this->books)) |
| | | $this->books[] = $contacts; |
| | | |
| | | return $contacts; |
| | | } |
| | |
| | | ); |
| | | } |
| | | |
| | | $plugin = $this->plugins->exec_hook('address_sources', array('sources' => $list)); |
| | | $plugin = $this->plugins->exec_hook('addressbooks_list', array('sources' => $list)); |
| | | $list = $plugin['sources']; |
| | | |
| | | if ($writeable && !empty($list)) { |
| | |
| | | $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null; |
| | | if(!empty($a_host['port'])) |
| | | $imap_port = $a_host['port']; |
| | | else if ($imap_ssl && $imap_ssl != 'tls') |
| | | else if ($imap_ssl && $imap_ssl != 'tls' && (!$config['default_port'] || $config['default_port'] == 143)) |
| | | $imap_port = 993; |
| | | } |
| | | |
| | |
| | | Inspired by Marco <P0L0_notspam_binware.org> |
| | | */ |
| | | // Check if we need to add domain |
| | | if (!empty($config['username_domain']) && !strpos($username, '@')) { |
| | | if (!empty($config['username_domain']) && strpos($username, '@') === false) { |
| | | if (is_array($config['username_domain']) && isset($config['username_domain'][$host])) |
| | | $username .= '@'.rcube_parse_host($config['username_domain'][$host]); |
| | | else if (is_string($config['username_domain'])) |
| | |
| | | if (($attrib['uppercase'] && strtolower($attrib['uppercase']=='first')) || $attrib['ucfirst']) |
| | | return ucfirst($text); |
| | | else if ($attrib['uppercase']) |
| | | return strtoupper($text); |
| | | return mb_strtoupper($text); |
| | | else if ($attrib['lowercase']) |
| | | return strtolower($text); |
| | | return mb_strtolower($text); |
| | | |
| | | return $text; |
| | | } |
| | |
| | | |
| | | if ($dh = @opendir(INSTALL_PATH . 'program/localization')) { |
| | | while (($name = readdir($dh)) !== false) { |
| | | if ($name{0}=='.' || !is_dir(INSTALL_PATH . 'program/localization/' . $name)) |
| | | if ($name[0] == '.' || !is_dir(INSTALL_PATH . 'program/localization/' . $name)) |
| | | continue; |
| | | |
| | | if ($label = $rcube_languages[$name]) |
| | |
| | | */ |
| | | public function kill_session() |
| | | { |
| | | $this->plugins->exec_hook('kill_session'); |
| | | $this->plugins->exec_hook('session_destroy'); |
| | | |
| | | $this->session->remove(); |
| | | $_SESSION = array('language' => $this->user->language, 'auth_time' => time(), 'temp' => true); |
| | |
| | | if (is_object($this->smtp)) |
| | | $this->smtp->disconnect(); |
| | | |
| | | if (is_object($this->contacts)) |
| | | $this->contacts->close(); |
| | | foreach ($this->books as $book) |
| | | if (is_object($book)) |
| | | $book->close(); |
| | | |
| | | // before closing the database connection, write session data |
| | | if ($_SERVER['REMOTE_ADDR']) |
| | |
| | | if (function_exists('mcrypt_module_open') && |
| | | ($td = mcrypt_module_open(MCRYPT_TripleDES, "", MCRYPT_MODE_CBC, ""))) |
| | | { |
| | | $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); |
| | | $iv = $this->create_iv(mcrypt_enc_get_iv_size($td)); |
| | | mcrypt_generic_init($td, $this->config->get_crypto_key($key), $iv); |
| | | $cipher = $iv . mcrypt_generic($td, $clear); |
| | | mcrypt_generic_deinit($td); |
| | |
| | | |
| | | if (function_exists('des')) { |
| | | $des_iv_size = 8; |
| | | $iv = ''; |
| | | for ($i = 0; $i < $des_iv_size; $i++) |
| | | $iv .= sprintf("%c", mt_rand(0, 255)); |
| | | $iv = $this->create_iv($des_iv_size); |
| | | $cipher = $iv . des($this->config->get_crypto_key($key), $clear, 1, 1, $iv); |
| | | } |
| | | else { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Generates encryption initialization vector (IV) |
| | | * |
| | | * @param int Vector size |
| | | * @return string Vector string |
| | | */ |
| | | private function create_iv($size) |
| | | { |
| | | // mcrypt_create_iv() can be slow when system lacks entrophy |
| | | // we'll generate IV vector manually |
| | | $iv = ''; |
| | | for ($i = 0; $i < $size; $i++) |
| | | $iv .= chr(mt_rand(0, 255)); |
| | | return $iv; |
| | | } |
| | | |
| | | /** |
| | | * Build a valid URL to this instance of RoundCube |
| | | * |
| | | * @param mixed Either a string with the action or url parameters as key-value pairs |