| | |
| | | <?php |
| | | /* |
| | | /** |
| | | +-------------------------------------------------------------------------+ |
| | | | Roundcube Webmail IMAP Client | |
| | | | Version 1.2-git | |
| | |
| | | rcmail::raise_error(array( |
| | | 'code' => 603, |
| | | 'type' => 'db', |
| | | 'message' => $err_str), FALSE, TRUE); |
| | | 'message' => $err_str), false, true); |
| | | } |
| | | |
| | | // error steps |
| | | if ($RCMAIL->action == 'error' && !empty($_GET['_code'])) { |
| | | rcmail::raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE); |
| | | rcmail::raise_error(array('code' => hexdec($_GET['_code'])), false, true); |
| | | } |
| | | |
| | | // check if https is required (for login) and redirect if necessary |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-------------------------------------------------------------------------+ |
| | | | Roundcube Webmail setup tool | |
| | | | Version 1.2-git | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/bc.php | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/clisetup.php | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/iniset.php | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail.php | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail_html_page.php | |
| | | | | |
| | |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Class to create an empty HTML page with some default styles |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | rcmail_install.php | |
| | | | | |
| | |
| | | | See the README file for a full license statement. | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Class to control the installation process of the Roundcube Webmail package |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail_output.php | |
| | | | | |
| | |
| | | parent::__construct(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Setter for page title |
| | | * |
| | |
| | | $this->pagetitle = $title; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for the current skin path property |
| | | */ |
| | |
| | | { |
| | | return $this->config->get('skin_path'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete all stored env variables and commands |
| | |
| | | $this->pagetitle = ''; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Call a client method |
| | | * |
| | |
| | | */ |
| | | abstract function command(); |
| | | |
| | | |
| | | /** |
| | | * Add a localized label to the client environment |
| | | */ |
| | | abstract function add_label(); |
| | | |
| | | |
| | | /** |
| | | * Register a template object handler |
| | |
| | | $this->object_handlers[$obj] = $func; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register a list of template object handlers |
| | | * |
| | |
| | | { |
| | | $this->object_handlers = array_merge($this->object_handlers, $arr); |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail_output_cli.php | |
| | | | | |
| | |
| | | { |
| | | // NOP |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail_output_html.php | |
| | | | | |
| | |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Class to create HTML page output using a skin template |
| | |
| | | |
| | | return $content; |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail_output_json.php | |
| | | | | |
| | |
| | | | Author: Aleksander Machniak <alec@alec.pl> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * View class to produce JSON responses |
| | |
| | | $this->command('set_pagetitle', empty($name) ? $title : $name.' :: '.$title); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register a template object handler |
| | | * |
| | |
| | | // ignore |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register a list of template object handlers |
| | | * |
| | |
| | | { |
| | | // ignore |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Call a client method |
| | |
| | | $this->commands[] = $cmd; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Add a localized label to the client environment |
| | | */ |
| | |
| | | $this->texts[$name] = $this->app->gettext($name); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Invoke display_message command |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete all stored env variables and commands |
| | | */ |
| | |
| | | $this->texts = array(); |
| | | $this->commands = array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Redirect to a certain url |
| | |
| | | exit; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Send an AJAX response to the client. |
| | | */ |
| | |
| | | $this->remote_response(); |
| | | exit; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Show error page and terminate script execution |
| | |
| | | $this->remote_response(); |
| | | exit; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Send an AJAX response with executable JS code |
| | |
| | | |
| | | echo self::json_serialize($response); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return executable javascript code for all registered commands |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail_string_replacer.php | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcmail_utils.php | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube PHP suite | |
| | | | Copyright (C) 2005-2015, The Roundcube Dev Team | |
| | |
| | | | Author: Aleksander Machniak <alec@alec.pl> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Roundcube Framework Initialization |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Parse a human readable string for a number of bytes. |
| | | * |
| | |
| | | return floatval($bytes); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Make sure the string ends with a slash |
| | | */ |
| | |
| | | return unslashify($str).'/'; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove slashes at the end of the string |
| | | */ |
| | |
| | | { |
| | | return preg_replace('/\/+$/', '', $str); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns number of seconds for a specified offset string. |
| | |
| | | return $amount; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create a unix timestamp with a specified offset from now. |
| | | * |
| | |
| | | { |
| | | return time() + get_offset_sec($offset_str) * $factor; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Truncate string if it is longer than the allowed length. |
| | |
| | | return $str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get all keys from array (recursive). |
| | | * |
| | |
| | | return $keys; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove all non-ascii and non-word chars except ., -, _ |
| | | */ |
| | |
| | | $allowed = 'a-z0-9\_\-' . (!$css_id ? '\.' : ''); |
| | | return preg_replace("/[^$allowed]/i", $replace_with, $str); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if a string contains only ascii characters |
| | |
| | | $regexp = $control_chars ? '/[^\x00-\x7F]/' : '/[^\x20-\x7E]/'; |
| | | return preg_match($regexp, $str) ? false : true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Compose a valid representation of name and e-mail address |
| | |
| | | return $email; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Format e-mail address |
| | | * |
| | |
| | | return $email; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fix version number so it can be used correctly in version_compare() |
| | | * |
| | |
| | | array('.0', '.99'), |
| | | $version); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * mbstring replacement functions |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2013, The Roundcube Dev Team | |
| | |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Class for HTML code creation |
| | |
| | | * @param string $tagname Tag name |
| | | * @param array $attrib Tag attributes as key/value pairs |
| | | * @param string $content Optinal Tag content (creates a container tag) |
| | | * @param array $allowed_attrib List with allowed attributes, omit to allow all |
| | | * @param array $allowed List with allowed attributes, omit to allow all |
| | | * |
| | | * @return string The XHTML tag |
| | | */ |
| | | public static function tag($tagname, $attrib = array(), $content = null, $allowed_attrib = null) |
| | | public static function tag($tagname, $attrib = array(), $content = null, $allowed = null) |
| | | { |
| | | if (is_string($attrib)) |
| | | if (is_string($attrib)) { |
| | | $attrib = array('class' => $attrib); |
| | | } |
| | | |
| | | $inline_tags = array('a','span','img'); |
| | | $suffix = $attrib['nl'] || ($content && $attrib['nl'] !== false && !in_array($tagname, $inline_tags)) ? "\n" : ''; |
| | |
| | | if (isset($content) || in_array($tagname, self::$containers)) { |
| | | $suffix = $attrib['noclose'] ? $suffix : '</' . $tagname . '>' . $suffix; |
| | | unset($attrib['noclose'], $attrib['nl']); |
| | | return '<' . $tagname . self::attrib_string($attrib, $allowed_attrib) . '>' . $content . $suffix; |
| | | return '<' . $tagname . self::attrib_string($attrib, $allowed) . '>' . $content . $suffix; |
| | | } |
| | | else { |
| | | return '<' . $tagname . self::attrib_string($attrib, $allowed_attrib) . '>' . $suffix; |
| | | return '<' . $tagname . self::attrib_string($attrib, $allowed) . '>' . $suffix; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Return DOCTYPE tag of specified type |
| | | * |
| | | * @param string $type Document type (html5, xhtml, 'xhtml-trans, xhtml-strict) |
| | | */ |
| | | public static function doctype($type) |
| | | { |
| | |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with class name |
| | | * @param string $cont Div content |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | if (is_string($attr)) { |
| | | $attr = array('class' => $attr); |
| | | } |
| | | |
| | | return self::tag('div', $attr, $cont, array_merge(self::$common_attrib, array('onclick'))); |
| | | } |
| | | |
| | |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with class name |
| | | * @param string $cont Paragraph content |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | if (is_string($attr)) { |
| | | $attr = array('class' => $attr); |
| | | } |
| | | |
| | | return self::tag('p', $attr, $cont, self::$common_attrib); |
| | | } |
| | | |
| | |
| | | * Derrived method to create <img /> |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with image source (src) |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | if (is_string($attr)) { |
| | | $attr = array('src' => $attr); |
| | | } |
| | | |
| | | return self::tag('img', $attr + array('alt' => ''), null, array_merge(self::$common_attrib, |
| | | array('src','alt','width','height','border','usemap','onclick','onerror'))); |
| | | } |
| | |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with link location (href) |
| | | * @param string $cont Link content |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | if (is_string($attr)) { |
| | | $attr = array('href' => $attr); |
| | | } |
| | | |
| | | return self::tag('a', $attr, $cont, array_merge(self::$common_attrib, |
| | | array('href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup'))); |
| | | } |
| | |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with class name |
| | | * @param string $cont Tag content |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | if (is_string($attr)) { |
| | | $attr = array('class' => $attr); |
| | | } |
| | | |
| | | return self::tag('span', $attr, $cont, self::$common_attrib); |
| | | } |
| | | |
| | |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with 'for' attrib |
| | | * @param string $cont Tag content |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | if (is_string($attr)) { |
| | | $attr = array('for' => $attr); |
| | | } |
| | | |
| | | return self::tag('label', $attr, $cont, array_merge(self::$common_attrib, array('for'))); |
| | | } |
| | | |
| | |
| | | * Derrived method to create <iframe></iframe> |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with frame source (src) |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | if (is_string($attr)) { |
| | | $attr = array('src' => $attr); |
| | | } |
| | | |
| | | return self::tag('iframe', $attr, $cont, array_merge(self::$common_attrib, |
| | | array('src','name','width','height','border','frameborder','onload','allowfullscreen'))); |
| | | } |
| | |
| | | * |
| | | * @param mixed $attr Hash array with tag attributes or string with script source (src) |
| | | * @param string $cont Javascript code to be placed as tag content |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | /** |
| | | * Derrived method for line breaks |
| | | * |
| | | * @param array $attrib Associative arry with tag attributes |
| | | * |
| | | * @return string HTML code |
| | | * @see html::tag() |
| | | */ |
| | |
| | | * |
| | | * @param array $attrib Associative arry with tag attributes |
| | | * @param array $allowed List of allowed attributes |
| | | * |
| | | * @return string Valid attribute string |
| | | */ |
| | | public static function attrib_string($attrib = array(), $allowed = null) |
| | |
| | | * Convert a HTML attribute string attributes to an associative array (name => value) |
| | | * |
| | | * @param string Input string |
| | | * |
| | | * @return array Key-value pairs of parsed attributes |
| | | */ |
| | | public static function parse_attrib_string($str) |
| | |
| | | * |
| | | * @param string $value Field value |
| | | * @param array $attrib Additional attributes to override |
| | | * |
| | | * @return string HTML output |
| | | */ |
| | | public function show($value = null, $attrib = null) |
| | |
| | | } |
| | | // set type |
| | | $this->attrib['type'] = $this->type; |
| | | |
| | | return parent::show(); |
| | | } |
| | | } |
| | |
| | | { |
| | | protected $tagname = 'input'; |
| | | protected $type = 'hidden'; |
| | | protected $fields_arr = array(); |
| | | protected $allowed = array('type','name','value','onchange','disabled','readonly'); |
| | | protected $fields_arr = array(); |
| | | |
| | | /** |
| | | * Constructor |
| | |
| | | foreach ($this->fields_arr as $attrib) { |
| | | $out .= self::tag($this->tagname, array('type' => $this->type) + $attrib); |
| | | } |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | |
| | | * |
| | | * @param string $value Value of the checked field |
| | | * @param array $attrib Additional attributes to override |
| | | * |
| | | * @return string HTML output |
| | | */ |
| | | public function show($value = '', $attrib = null) |
| | |
| | | * |
| | | * @param string $value Value of the checked field |
| | | * @param array $attrib Additional attributes to override |
| | | * |
| | | * @return string HTML output |
| | | */ |
| | | public function show($value = '', $attrib = null) |
| | |
| | | * |
| | | * @param string $value Textbox value |
| | | * @param array $attrib Additional attributes to override |
| | | * |
| | | * @return string HTML output |
| | | */ |
| | | public function show($value = '', $attrib = null) |
| | |
| | | * |
| | | * @param string $select Value of the selection option |
| | | * @param array $attrib Additional attributes to override |
| | | * |
| | | * @return string HTML output |
| | | */ |
| | | public function show($select = array(), $attrib = null) |
| | |
| | | * Build HTML output of the table data |
| | | * |
| | | * @param array $attrib Table attributes |
| | | * |
| | | * @return string The final table HTML code |
| | | */ |
| | | public function show($attrib = null) |
| | |
| | | static $col_tagnames = array('table' => 'td', '*' => 'span'); |
| | | return $col_tagnames[$this->tagname] ?: $col_tagnames['*']; |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2014, The Roundcube Dev Team | |
| | |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Base class of the Roundcube Framework |
| | |
| | | return self::$instance; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Private constructor |
| | | */ |
| | |
| | | |
| | | register_shutdown_function(array($this, 'shutdown')); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initial startup function |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get the current database connection |
| | | * |
| | |
| | | |
| | | return $this->db; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get global handle for memcache access |
| | |
| | | return $this->memcache; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Callback for memcache failure |
| | | */ |
| | |
| | | true, false); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initialize and get cache object |
| | |
| | | |
| | | return $this->caches[$name]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initialize and get shared cache object |
| | |
| | | return $this->caches[$shared_name]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create SMTP object and connect to server |
| | | * |
| | | * @param boolean True if connection should be established |
| | | * @param boolean $connect True if connection should be established |
| | | */ |
| | | public function smtp_init($connect = false) |
| | | { |
| | |
| | | $this->smtp->connect(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initialize and get storage object |
| | |
| | | |
| | | return $this->storage; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initialize storage object |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set special folders type association. |
| | | * This must be done AFTER connecting to the server! |
| | |
| | | $storage->create_default_folders(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Callback for IMAP connection events to log session identifiers |
| | |
| | | $this->gc_temp(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Garbage collector function for temp files. |
| | | * Remove temp files older than two days |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Runs garbage collector with probability based on |
| | | * session settings. This is intended for environments |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get localized text in the desired language |
| | |
| | | return strtr($text, array('\n' => "\n")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if the given text label exists |
| | | * |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Load a localization package |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check the given string and return a valid language code |
| | | * |
| | | * @param string Language code |
| | | * @param string $lang Language code |
| | | * |
| | | * @return string Valid language code |
| | | */ |
| | |
| | | return $lang; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Read directory program/localization and return a list of available languages |
| | | * |
| | |
| | | return $sa_languages; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Encrypt using 3DES |
| | | * |
| | | * @param string $clear clear text input |
| | | * @param string $key encryption key to retrieve from the configuration, defaults to 'des_key' |
| | | * @param boolean $base64 whether or not to base64_encode() the result before returning |
| | | * @param string $clear Clear text input |
| | | * @param string $key Encryption key to retrieve from the configuration, defaults to 'des_key' |
| | | * @param boolean $base64 Whether or not to base64_encode() the result before returning |
| | | * |
| | | * @return string encrypted text |
| | | */ |
| | |
| | | return ''; |
| | | } |
| | | |
| | | /*- |
| | | * Add a single canary byte to the end of the clear text, which |
| | | * will help find out how much of padding will need to be removed |
| | | * upon decryption; see http://php.net/mcrypt_generic#68082 |
| | | */ |
| | | // Add a single canary byte to the end of the clear text, which |
| | | // will help find out how much of padding will need to be removed |
| | | // upon decryption; see http://php.net/mcrypt_generic#68082. |
| | | $clear = pack("a*H2", $clear, "80"); |
| | | $ckey = $this->config->get_crypto_key($key); |
| | | |
| | |
| | | return $base64 ? base64_encode($cipher) : $cipher; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Decrypt 3DES-encrypted string |
| | | * |
| | | * @param string $cipher encrypted text |
| | | * @param string $key encryption key to retrieve from the configuration, defaults to 'des_key' |
| | | * @param boolean $base64 whether or not input is base64-encoded |
| | | * @param string $cipher Encrypted text |
| | | * @param string $key Encryption key to retrieve from the configuration, defaults to 'des_key' |
| | | * @param boolean $base64 Whether or not input is base64-encoded |
| | | * |
| | | * @return string decrypted text |
| | | */ |
| | |
| | | } |
| | | } |
| | | |
| | | /*- |
| | | * Trim PHP's padding and the canary byte; see note in |
| | | * rcube::encrypt() and http://php.net/mcrypt_generic#68082 |
| | | */ |
| | | // Trim PHP's padding and the canary byte; see note in |
| | | // rcube::encrypt() and http://php.net/mcrypt_generic#68082 |
| | | $clear = substr(rtrim($clear, "\0"), 0, -1); |
| | | |
| | | return $clear; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Generates encryption initialization vector (IV) |
| | | * |
| | | * @param int Vector size |
| | | * @param int $size Vector size |
| | | * |
| | | * @return string Vector string |
| | | */ |
| | |
| | | |
| | | return $iv; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns session token for secure URLs |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Generate a unique token to be used in a form request |
| | | * |
| | |
| | | return $plugin['value']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if the current request contains a valid token. |
| | | * Empty requests aren't checked until use_secure_urls is set. |
| | | * |
| | | * @param int Request method |
| | | * @param int $mode Request method |
| | | * |
| | | * @return boolean True if request token is valid false if not |
| | | */ |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Build a valid URL to this instance of Roundcube |
| | | * |
| | | * @param mixed Either a string with the action or url parameters as key-value pairs |
| | | * @param mixed $p Either a string with the action or url parameters as key-value pairs |
| | | * |
| | | * @return string Valid application URL |
| | | */ |
| | | public function url($p) |
| | |
| | | // STUB: should be overloaded by the application |
| | | return ''; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Function to be executed in script shutdown |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Registers shutdown function to be executed on shutdown. |
| | | * The functions will be executed before destroying any |
| | |
| | | $this->shutdown_functions[] = $function; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Quote a given string. |
| | | * Shortcut function for rcube_utils::rep_specialchars_output() |
| | |
| | | return rcube_utils::rep_specialchars_output($str, 'html', $mode, $newlines); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Quote a given string for javascript output. |
| | | * Shortcut function for rcube_utils::rep_specialchars_output() |
| | |
| | | { |
| | | return rcube_utils::rep_specialchars_output($str, 'js'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Construct shell command, execute it and return output as string. |
| | |
| | | return (string)shell_exec($cmd); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Print or write debug messages |
| | | * |
| | |
| | | if ($plugin['abort']) { |
| | | return; |
| | | } |
| | | |
| | | $args = $plugin['args']; |
| | | } |
| | | |
| | |
| | | self::write_log('console', join(";\n", $msg)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Append a line to a logfile in the logs directory. |
| | | * Date will be added automatically to the line. |
| | | * |
| | | * @param $name name of log file |
| | | * @param line Line to append |
| | | * @param string $name Name of the log file |
| | | * @param mixed $line Line to append |
| | | */ |
| | | public static function write_log($name, $line) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Throw system error (and show error page). |
| | | * |
| | | * @param array Named parameters |
| | | * @param array $arg Named parameters |
| | | * - code: Error code (required) |
| | | * - type: Error type [php|db|imap|javascript] (required) |
| | | * - message: Error message |
| | | * - file: File where error occurred |
| | | * - line: Line where error occurred |
| | | * @param boolean True to log the error |
| | | * @param boolean Terminate script execution |
| | | * @param boolean $log True to log the error |
| | | * @param boolean $terminate Terminate script execution |
| | | */ |
| | | public static function raise_error($arg = array(), $log = false, $terminate = false) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Report error according to configured debug_level |
| | | * |
| | | * @param array Named parameters |
| | | * @param array $arg_arr Named parameters |
| | | * @see self::raise_error() |
| | | */ |
| | | public static function log_bug($arg_arr) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Write debug info to the log |
| | | * |
| | | * @param string Engine type - file name (memcache, apc) |
| | | * @param string Data string to log |
| | | * @param bool Operation result |
| | | * @param string $engine Engine type - file name (memcache, apc) |
| | | * @param string $data Data string to log |
| | | * @param bool $result Operation result |
| | | */ |
| | | public static function debug($engine, $data, $result = null) |
| | | { |
| | |
| | | self::write_log($engine, $line); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns current time (with microseconds). |
| | | * |
| | |
| | | { |
| | | return microtime(true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Logs time difference according to provided timer |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for logged user name. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for logged user email (derived from user name not identity). |
| | | * |
| | |
| | | return $this->user->get_username('mail'); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for logged user password. |
| | |
| | | |
| | | return $sent; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2006-2013, The Roundcube Dev Team | |
| | |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Abstract skeleton of an address book/repository |
| | |
| | | public $page_size = 10; |
| | | public $sort_col = 'name'; |
| | | public $sort_order = 'ASC'; |
| | | public $coltypes = array('name' => array('limit'=>1), 'firstname' => array('limit'=>1), 'surname' => array('limit'=>1), 'email' => array('limit'=>1)); |
| | | public $date_cols = array(); |
| | | public $coltypes = array( |
| | | 'name' => array('limit'=>1), |
| | | 'firstname' => array('limit'=>1), |
| | | 'surname' => array('limit'=>1), |
| | | 'email' => array('limit'=>1) |
| | | ); |
| | | |
| | | protected $error; |
| | | |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | private $base_url; |
| | | |
| | | |
| | | /** |
| | | * Class constructor |
| | | * |
| | | * @param string $base Base URL |
| | | */ |
| | | public function __construct($base) |
| | | { |
| | | $this->base_url = $base; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Replace callback |
| | | * |
| | | * @param array $matches Matching entries |
| | | * |
| | | * @return string Replaced text with absolute URL |
| | | */ |
| | | public function callback($matches) |
| | | { |
| | | return $matches[1] . '="' . self::absolute_url($matches[3], $this->base_url) . '"'; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert base URLs to absolute ones |
| | | * |
| | | * @param string $body Text body |
| | | * |
| | | * @return string Replaced text |
| | | */ |
| | | public function replace($body) |
| | | { |
| | | return preg_replace_callback(array( |
| | | $regexp = array( |
| | | '/(src|background|href)=(["\']?)([^"\'\s>]+)(\2|\s|>)/i', |
| | | '/(url\s*\()(["\']?)([^"\'\)\s]+)(\2)\)/i', |
| | | ), |
| | | array($this, 'callback'), $body); |
| | | } |
| | | ); |
| | | |
| | | return preg_replace_callback($regexp, array($this, 'callback'), $body); |
| | | } |
| | | |
| | | /** |
| | | * Convert paths like ../xxx to an absolute path using a base url |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2007-2009, The Roundcube Dev Team | |
| | |
| | | $this->imgdata = !$this->ie; |
| | | } |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2011, The Roundcube Dev Team | |
| | |
| | | | Author: Aleksander Machniak <alec@alec.pl> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Interface class for accessing Roundcube cache |
| | |
| | | $this->prefix = $prefix; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns cached value. |
| | | * |
| | |
| | | return $this->cache[$key]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets (add/update) value in cache. |
| | | * |
| | |
| | | $this->cache[$key] = $data; |
| | | $this->cache_changes[$key] = true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns cached value without storing it in internal memory. |
| | |
| | | return $this->read_record($key, true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets (add/update) value in cache and immediately saves |
| | | * it in the backend, no internal memory will be used. |
| | |
| | | { |
| | | return $this->write_record($key, $this->serialize($data)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears the cache. |
| | |
| | | $this->remove_record($key, $prefix_mode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove cache records older than ttl |
| | | */ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove expired records of all caches |
| | | */ |
| | |
| | | |
| | | $db->query("DELETE FROM " . $db->table_name('cache', true) . " WHERE `expires` < " . $db->now()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes the cache back to the DB. |
| | |
| | | $this->write_index(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reads cache entry. |
| | |
| | | return $this->cache[$key]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes single cache record into DB. |
| | | * |
| | |
| | | return $this->db->affected_rows($result); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Deletes the cache record(s). |
| | | * |
| | |
| | | $this->userid); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Adds entry into memcache/apc DB. |
| | | * |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Deletes entry from memcache/apc DB. |
| | | * |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes the index entry into memcache/apc DB. |
| | |
| | | $this->add_record($this->ikey(), $data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets the index entry from memcache/apc DB. |
| | | */ |
| | |
| | | $this->index = $data ? unserialize($data) : array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Creates per-user cache key name (for memcache and apc) |
| | | * |
| | |
| | | { |
| | | return sprintf('%d:%s:%s', $this->userid, $this->prefix, $key); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Creates per-user index cache key name (for memcache and apc) |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2011-2013, The Roundcube Dev Team | |
| | |
| | | | Author: Aleksander Machniak <alec@alec.pl> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Interface class for accessing Roundcube shared cache |
| | |
| | | $this->prefix = $prefix; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns cached value. |
| | | * |
| | |
| | | return $this->cache[$key]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets (add/update) value in cache. |
| | | * |
| | |
| | | $this->cache[$key] = $data; |
| | | $this->cache_changes[$key] = true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns cached value without storing it in internal memory. |
| | |
| | | return $this->read_record($key, true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets (add/update) value in cache and immediately saves |
| | | * it in the backend, no internal memory will be used. |
| | |
| | | { |
| | | return $this->write_record($key, $this->serialize($data)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears the cache. |
| | |
| | | $this->remove_record($key, $prefix_mode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove cache records older than ttl |
| | | */ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove expired records of all caches |
| | | */ |
| | |
| | | |
| | | $db->query("DELETE FROM " . $db->table_name('cache_shared', true) . " WHERE `expires` < " . $db->now()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes the cache back to the DB. |
| | |
| | | $this->write_index(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reads cache entry. |
| | |
| | | return $this->cache[$key]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes single cache record into DB. |
| | | * |
| | |
| | | return $this->db->affected_rows($result); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Deletes the cache record(s). |
| | | * |
| | |
| | | $this->db->query("DELETE FROM " . $this->table . $where); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Adds entry into memcache/apc DB. |
| | | * |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Deletes entry from memcache/apc DB. |
| | | * |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Writes the index entry into memcache/apc DB. |
| | |
| | | $this->add_record($this->ikey(), $data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets the index entry from memcache/apc DB. |
| | | */ |
| | |
| | | $this->index = $data ? unserialize($data) : array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Creates cache key name (for memcache and apc) |
| | | * |
| | |
| | | { |
| | | return $this->prefix . ':' . $key; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Creates index cache key name (for memcache and apc) |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | { |
| | | throw new ErrorException($errstr, 0, $errno); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Parse and validate charset name string (see #1485758). |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert a string from one charset to another. |
| | |
| | | return $str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts string from standard UTF-7 (RFC 2152) to UTF-8. |
| | | * |
| | | * @param string Input string (UTF-7) |
| | | * @param string $str Input string (UTF-7) |
| | | * |
| | | * @return string Converted string (UTF-8) |
| | | */ |
| | |
| | | return $res; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts string from UTF-16 to UTF-8 (helper for utf-7 to utf-8 conversion) |
| | | * |
| | | * @param string Input string |
| | | * @param string $str Input string |
| | | * |
| | | * @return string The converted string |
| | | */ |
| | |
| | | |
| | | return $dec; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert the data ($str) from RFC 2060's UTF-7 to UTF-8. |
| | |
| | | |
| | | return $p; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert the data ($str) from UTF-8 to RFC 2060's UTF-7. |
| | |
| | | return $p; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * A method to guess character set of a string. |
| | | * |
| | |
| | | return $failover; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Removes non-unicode characters from input. |
| | | * |
| | |
| | | |
| | | return $out; |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2014, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2006-2012, The Roundcube Dev Team | |
| | |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Model class for the local address book database |
| | |
| | | /** |
| | | * Object constructor |
| | | * |
| | | * @param object Instance of the rcube_db class |
| | | * @param integer User-ID |
| | | * @param object $dbconn Instance of the rcube_db class |
| | | * @param integer $user User-ID |
| | | */ |
| | | function __construct($dbconn, $user) |
| | | { |
| | |
| | | $this->ready = $this->db && !$this->db->is_error(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns addressbook name |
| | | */ |
| | |
| | | { |
| | | return $this->name; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Save a search string for future listings |
| | |
| | | $this->cache = null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for saved search properties |
| | | * |
| | |
| | | { |
| | | return $this->filter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Setter for the current group |
| | |
| | | $this->cache = null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reset all saved results and search parameters |
| | | */ |
| | |
| | | $this->cache = null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * List all active contact groups of this source |
| | | * |
| | | * @param string Search string to match group name |
| | | * @param int Matching mode: |
| | | * @param string $search Search string to match group name |
| | | * @param int $mode Matching mode: |
| | | * 0 - partial (*abc*), |
| | | * 1 - strict (=), |
| | | * 2 - prefix (abc*) |
| | |
| | | return $results; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get group properties such as name and email address(es) |
| | | * |
| | | * @param string Group identifier |
| | | * @param string $group_id Group identifier |
| | | * |
| | | * @return array Group properties as hash array |
| | | */ |
| | | function get_group($group_id) |
| | |
| | | * @param array List of cols to show, Null means all |
| | | * @param int Only return this number of records, use negative values for tail |
| | | * @param boolean True to skip the count query (select only) |
| | | * |
| | | * @return array Indexed list of contact records, each a hash array |
| | | */ |
| | | function list_records($cols=null, $subset=0, $nocount=false) |
| | |
| | | return $this->result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Search contacts |
| | | * |
| | |
| | | */ |
| | | function search($fields, $value, $mode=0, $select=true, $nocount=false, $required=array()) |
| | | { |
| | | if (!is_array($required) && !empty($required)) |
| | | if (!is_array($required) && !empty($required)) { |
| | | $required = array($required); |
| | | } |
| | | |
| | | $where = $and_where = $post_search = array(); |
| | | $mode = intval($mode); |
| | |
| | | return new rcube_result_set($count, ($this->list_page-1) * $this->page_size); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Count number of available contacts in database |
| | | * |
| | |
| | | return $this->cache['count']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the last result set |
| | | * |
| | |
| | | return $this->result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get a specific contact record |
| | | * |
| | | * @param mixed record identifier(s) |
| | | * @param mixed $id Record identifier(s) |
| | | * @param bool $assoc Enables returning associative array |
| | | * |
| | | * @return mixed Result object with all record fields or False if not found |
| | | */ |
| | | function get_record($id, $assoc=false) |
| | | { |
| | | // return cached result |
| | | if ($this->result && ($first = $this->result->first()) && $first[$this->primary_key] == $id) |
| | | if ($this->result && ($first = $this->result->first()) && $first[$this->primary_key] == $id) { |
| | | return $assoc ? $first : $this->result; |
| | | } |
| | | |
| | | $this->db->query( |
| | | "SELECT * FROM " . $this->db->table_name($this->db_name, true). |
| | |
| | | return $assoc && $record ? $record : $this->result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get group assignments of a specific contact record |
| | | * |
| | | * @param mixed Record identifier |
| | | * @param mixed $id Record identifier |
| | | * |
| | | * @return array List of assigned groups as ID=>Name pairs |
| | | */ |
| | | function get_record_groups($id) |
| | | { |
| | | $results = array(); |
| | | |
| | | if (!$this->groups) |
| | | if (!$this->groups) { |
| | | return $results; |
| | | } |
| | | |
| | | $sql_result = $this->db->query( |
| | | "SELECT cgm.`contactgroup_id`, cg.`name` " |
| | |
| | | . " WHERE cgm.`contact_id` = ?", |
| | | $id |
| | | ); |
| | | |
| | | while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { |
| | | $results[$sql_arr['contactgroup_id']] = $sql_arr['name']; |
| | | } |
| | |
| | | return $results; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check the given data before saving. |
| | | * If input not valid, the message to display can be fetched using get_error() |
| | | * |
| | | * @param array Assoziative array with data to save |
| | | * @param boolean Try to fix/complete record automatically |
| | | * @param array $save_data Associative array with data to save |
| | | * @param boolean $autofix Try to fix/complete record automatically |
| | | * |
| | | * @return boolean True if input is valid, False if not. |
| | | */ |
| | | public function validate(&$save_data, $autofix = false) |
| | |
| | | return $valid; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create a new contact record |
| | | * |
| | | * @param array Associative array with save data |
| | | * @param array $save_data Associative array with save data |
| | | * @param bool $check Enables validity checks |
| | | * |
| | | * @return integer|boolean The created record ID on success, False on error |
| | | */ |
| | | function insert($save_data, $check=false) |
| | | { |
| | | if (!is_array($save_data)) |
| | | if (!is_array($save_data)) { |
| | | return false; |
| | | } |
| | | |
| | | $insert_id = $existing = false; |
| | | |
| | |
| | | return $insert_id; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Update a specific contact record |
| | | * |
| | | * @param mixed Record identifier |
| | | * @param array Assoziative array with save data |
| | | * @param mixed $id Record identifier |
| | | * @param array $save_cols Associative array with save data |
| | | * |
| | | * @return boolean True on success, False on error |
| | | */ |
| | |
| | | return $updated ? true : false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert data stored in the database into output format |
| | | */ |
| | | private function convert_db_data($sql_arr) |
| | | { |
| | | $record = array(); |
| | |
| | | return $record; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert input data for storing in the database |
| | | */ |
| | | private function convert_save_data($save_data, $record = array()) |
| | | { |
| | | $out = array(); |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Mark one or more contact records as deleted |
| | | * |
| | | * @param array Record identifiers |
| | | * @param boolean Remove record(s) irreversible (unsupported) |
| | | * @param array $ids Record identifiers |
| | | * @param boolean $force Remove record(s) irreversible (unsupported) |
| | | */ |
| | | function delete($ids, $force=true) |
| | | { |
| | | if (!is_array($ids)) |
| | | if (!is_array($ids)) { |
| | | $ids = explode(self::SEPARATOR, $ids); |
| | | } |
| | | |
| | | $ids = $this->db->array2list($ids, 'integer'); |
| | | |
| | |
| | | return $this->db->affected_rows(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Undelete one or more contact records |
| | | * |
| | | * @param array Record identifiers |
| | | * @param array $ids Record identifiers |
| | | */ |
| | | function undelete($ids) |
| | | { |
| | | if (!is_array($ids)) |
| | | if (!is_array($ids)) { |
| | | $ids = explode(self::SEPARATOR, $ids); |
| | | } |
| | | |
| | | $ids = $this->db->array2list($ids, 'integer'); |
| | | |
| | |
| | | |
| | | return $this->db->affected_rows(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove all records from the database |
| | |
| | | return $count; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create a contact group with the given name |
| | | * |
| | | * @param string The group name |
| | | * @param string $name The group name |
| | | * |
| | | * @return mixed False on error, array with record props in success |
| | | */ |
| | | function create_group($name) |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete the given group (and all linked group members) |
| | | * |
| | | * @param string Group identifier |
| | | * @param string $gid Group identifier |
| | | * |
| | | * @return boolean True on success, false if no data was changed |
| | | */ |
| | | function delete_group($gid) |
| | |
| | | /** |
| | | * Rename a specific contact group |
| | | * |
| | | * @param string Group identifier |
| | | * @param string New name to set for this group |
| | | * @param string $gid Group identifier |
| | | * @param string $name New name to set for this group |
| | | * @param string $new_gid (not used) |
| | | * |
| | | * @return boolean New name on success, false if no data was changed |
| | | */ |
| | | function rename_group($gid, $newname, &$new_gid) |
| | | function rename_group($gid, $name, &$new_gid) |
| | | { |
| | | // make sure we have a unique name |
| | | $name = $this->unique_groupname($newname); |
| | | $name = $this->unique_groupname($name); |
| | | |
| | | $sql_result = $this->db->query( |
| | | "UPDATE " . $this->db->table_name($this->db_groups, true). |
| | |
| | | return $this->db->affected_rows($sql_result) ? $name : false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Add the given contact records the a certain group |
| | | * |
| | |
| | | */ |
| | | function add_to_group($group_id, $ids) |
| | | { |
| | | if (!is_array($ids)) |
| | | if (!is_array($ids)) { |
| | | $ids = explode(self::SEPARATOR, $ids); |
| | | } |
| | | |
| | | $added = 0; |
| | | $exists = array(); |
| | |
| | | " AND `contact_id` IN (".$this->db->array2list($ids, 'integer').")", |
| | | $group_id |
| | | ); |
| | | |
| | | while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { |
| | | $exists[] = $sql_arr['contact_id']; |
| | | } |
| | | |
| | | // ... and remove them from the list |
| | | $ids = array_diff($ids, $exists); |
| | | |
| | |
| | | $contact_id |
| | | ); |
| | | |
| | | if ($error = $this->db->is_error()) |
| | | if ($error = $this->db->is_error()) { |
| | | $this->set_error(self::ERROR_SAVING, $error); |
| | | else |
| | | } |
| | | else { |
| | | $added++; |
| | | } |
| | | } |
| | | |
| | | return $added; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove the given contact records from a certain group |
| | |
| | | return $this->db->affected_rows($sql_result); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check for existing groups with the same name |
| | | * |
| | | * @param string Name to check |
| | | * @param string $name Name to check |
| | | * |
| | | * @return string A group name which is unique for the current use |
| | | */ |
| | | private function unique_groupname($name) |
| | | { |
| | | $checkname = $name; |
| | | $num = 2; $hit = false; |
| | | $num = 2; |
| | | $hit = false; |
| | | |
| | | do { |
| | | $sql_result = $this->db->query( |
| | |
| | | if ($hit = $this->db->fetch_array($sql_result)) { |
| | | $checkname = $name . ' ' . $num++; |
| | | } |
| | | } while ($hit); |
| | | } |
| | | while ($hit); |
| | | |
| | | return $checkname; |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2011, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2012, The Roundcube Dev Team | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Import contacts from CSV file |
| | | * |
| | | * @param string $csv Content of the CSV file |
| | | */ |
| | | public function import($csv) |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Export vCards |
| | | * |
| | | * @return array rcube_vcard List of vcards |
| | | */ |
| | | public function export() |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2011-2014, Kolab Systems AG | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | return $body; |
| | | } |
| | | |
| | | /** |
| | | * Converts Enriched text into HTML format |
| | | * |
| | | * @param string $body Enriched text |
| | | * |
| | | * @return string HTML text |
| | | */ |
| | | public static function to_html($body) |
| | | { |
| | | $body = str_replace('<<','<',$body); |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | ); |
| | | |
| | | |
| | | /** |
| | | * Class constructor |
| | | * |
| | | * @param string $filename Image file name/path |
| | | */ |
| | | function __construct($filename) |
| | | { |
| | | $this->image_file = $filename; |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Magic getter for backward compat. |
| | | * |
| | |
| | | return $this->{$name}; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Connect to an IMAP server |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Close IMAP connection. |
| | | * Usually done on script shutdown |
| | |
| | | $this->mcache->close(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check connection state, connect if not connected. |
| | |
| | | return $this->is_connected(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks IMAP connection. |
| | | * |
| | |
| | | { |
| | | return $this->conn->connected(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns code of last error |
| | |
| | | return $this->conn->errornum; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns text of last error |
| | | * |
| | |
| | | { |
| | | return $this->conn->error; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns code of last command response |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Activate/deactivate debug mode |
| | | * |
| | |
| | | $this->conn->setDebug($dbg, array($this, 'debug_handler')); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal folder reference. |
| | | * All operations will be perfomed on this folder. |
| | |
| | | { |
| | | $this->folder = $folder; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Save a search result for future message listing methods |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the saved search set as hash array |
| | | * |
| | |
| | | $this->search_sorted, |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the IMAP server's capability. |
| | |
| | | return $_SESSION[$sess_key]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks the PERMANENTFLAGS capability of the current folder |
| | | * and returns true if the given flag is supported by the IMAP server |
| | |
| | | |
| | | return $imap_flag && !empty($perm_flags) && in_array_nocase($imap_flag, $perm_flags); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns PERMANENTFLAGS of the specified folder |
| | |
| | | return $permflags; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the delimiter that is used by the IMAP server for folder separation |
| | | * |
| | | * @return string Delimiter string |
| | | * @access public |
| | | */ |
| | | public function get_hierarchy_delimiter() |
| | | { |
| | | return $this->delimiter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get namespace |
| | |
| | | unset($ns['prefix']); |
| | | return $ns; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets delimiter and namespaces |
| | |
| | | $_SESSION['imap_delimiter'] = $this->delimiter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get message count for a specific folder |
| | | * |
| | |
| | | |
| | | return $this->countmessages($folder, $mode, $force, $status); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected method for getting nr of messages |
| | |
| | | return (int)$count; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Public method for listing message flags |
| | | * |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Public method for listing headers |
| | | * |
| | |
| | | |
| | | return $this->_list_messages($folder, $page, $sort_field, $sort_order, $slice); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected method for listing message headers |
| | |
| | | return array_values($a_msg_headers); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected method for listing message headers using threads |
| | | * |
| | |
| | | return $this->icache['threads'] = $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Method for direct fetching of threads data |
| | | * |
| | |
| | | return $this->conn->thread($folder, $this->threading, |
| | | $this->options['skip_deleted'] ? 'UNDELETED' : '', true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected method for fetching threaded messages headers |
| | |
| | | return array_values($a_msg_headers); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected method for setting threaded messages flags: |
| | | * depth, has_children and unread_children |
| | |
| | | $headers[$uid]->has_children = $msg_children[$uid]; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected method for listing a set of message headers (search results) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected method for listing a set of threaded message headers (search results) |
| | | * |
| | |
| | | |
| | | return $this->fetch_thread_headers($folder, clone $this->search_set, $page, $slice); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches messages headers (by UID) |
| | |
| | | return $a_msg_headers; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns current status of a folder (compared to the last time use) |
| | | * |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Stores folder statistic data in session |
| | | * @TODO: move to separate DB table (cache?) |
| | |
| | | { |
| | | $_SESSION['folders'][$folder][$name] = $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets folder statistic data |
| | |
| | | |
| | | return array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return sorted list of message UIDs |
| | |
| | | return $this->index_direct($folder, $this->sort_field, $this->sort_order); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return sorted list of message UIDs ignoring current search settings. |
| | | * Doesn't uses cache by default. |
| | |
| | | return $index; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return index of threaded message UIDs |
| | | * |
| | |
| | | return $threads; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sort threaded result, using THREAD=REFS method if available. |
| | | * If not, use any method and re-sort the result in THREAD=REFS way. |
| | |
| | | $threads->revert(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Invoke search request to IMAP server |
| | |
| | | return $results; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Direct (real and simple) SEARCH request (without result sorting and caching). |
| | | * |
| | |
| | | |
| | | return $index; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * protected search method |
| | |
| | | return $messages; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts charset of search criteria string |
| | | * |
| | |
| | | return $res; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Refresh saved search set |
| | | * |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return message headers object of a specific message |
| | |
| | | |
| | | return $headers; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetch message headers and body structure from the IMAP server and build |
| | |
| | | |
| | | return $this->icache['message'] = $headers; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Build message part object |
| | |
| | | return $struct; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set attachment filename from message part structure |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get charset name from message structure (first part) |
| | | * |
| | |
| | | * |
| | | * @return string Message/part body if not printed |
| | | */ |
| | | public function get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL, $skip_charset_conv=false, $max_bytes=0, $formatted=true) |
| | | public function get_message_part($uid, $part = 1, $o_part = null, $print = null, $fp = null, |
| | | $skip_charset_conv = false, $max_bytes = 0, $formatted = true) |
| | | { |
| | | if (!$this->check_connection()) { |
| | | return null; |
| | |
| | | return $body; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the whole message source as string (or saves to a file) |
| | | * |
| | |
| | | true, $part, null, false, $fp); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the message headers as string |
| | | * |
| | |
| | | return $this->conn->fetchPartHeader($this->folder, $uid, true, $part); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sends the whole message source to stdout |
| | | * |
| | |
| | | |
| | | $this->conn->handlePartBody($this->folder, $uid, true, null, null, true, null, $formatted); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set message flag to one or several messages |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Append a mail message (source) to a specific folder |
| | | * |
| | |
| | | |
| | | return $saved; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Move a message from one folder to another |
| | |
| | | return $moved; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Copy a message from one folder to another |
| | | * |
| | |
| | | |
| | | return $copied; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Mark messages as deleted and expunge them |
| | |
| | | |
| | | return $deleted; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Send IMAP expunge command and clear cache |
| | |
| | | return $a_mboxes; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Method for direct folders listing (LSUB) |
| | | * |
| | |
| | | |
| | | return $a_folders; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get a list of all folders available on the server |
| | |
| | | return $a_mboxes; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Method for direct folders listing (LIST) |
| | | * |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fix folders list by adding folders from other namespaces. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Filter the given list of folders according to access rights |
| | | * |
| | |
| | | return $a_folders; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get mailbox quota information |
| | | * |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get folder size (size of all messages in a folder) |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Subscribe to a specific folder(s) |
| | | * |
| | |
| | | return $this->change_subscription($folders, 'subscribe'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Unsubscribe folder(s) |
| | | * |
| | |
| | | // let this common function do the main work |
| | | return $this->change_subscription($folders, 'unsubscribe'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create a new folder on the server and register it in local cache |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set a new name to an existing folder |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove folder from server |
| | | * |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Detect special folder associations stored in storage backend |
| | | */ |
| | |
| | | return array_merge($result, $special); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set special folder associations stored in storage backend |
| | | */ |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks if folder exists and is subscribed |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the namespace where the folder is in |
| | | * |
| | |
| | | |
| | | return 'personal'; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Modify folder name according to namespace. |
| | |
| | | return $folder; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets folder attributes from LIST response, e.g. \Noselect, \Noinferiors |
| | | * |
| | |
| | | |
| | | return is_array($opts) ? $opts : array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets connection (and current folder) data: UIDVALIDITY, EXISTS, RECENT, |
| | |
| | | |
| | | return $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns extended information about the folder |
| | |
| | | return $options; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Synchronizes messages cache. |
| | | * |
| | |
| | | $mcache->synchronize($folder); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get message header names for rcube_imap_generic::fetchHeader(s) |
| | |
| | | return $this->conn->setACL($folder, $user, $acl); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Removes any <identifier,rights> pair for the |
| | | * specified user from the ACL for the specified |
| | |
| | | return $this->conn->deleteACL($folder, $user); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the access control list for folder (GETACL) |
| | | * |
| | |
| | | |
| | | return $this->conn->getACL($folder); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns information about what rights can be granted to the |
| | |
| | | return $this->conn->listRights($folder, $user); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the set of rights that the current user has to |
| | | * folder (MYRIGHTS) |
| | |
| | | |
| | | return $this->conn->myRights($folder); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets IMAP metadata/annotations (SETMETADATA/SETANNOTATION) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Unsets IMAP metadata/annotations (SETMETADATA/SETANNOTATION) |
| | | * |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns IMAP metadata/annotations (GETMETADATA/GETANNOTATION) |
| | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts the METADATA extension entry name into the correct |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for messages cache object |
| | | */ |
| | |
| | | return $this->mcache; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears the messages cache. |
| | | * |
| | |
| | | $mcache->clear($folder, $uids); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete outdated cache entries |
| | |
| | | $this->sort_order = strtoupper($sort_order) == 'DESC' ? 'DESC' : 'ASC'; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sort folders first by default folders and then in alphabethical order |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Find UID of the specified message sequence ID |
| | | * |
| | |
| | | |
| | | return $uid; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Subscribe/unsubscribe a list of folders and update local cache |
| | |
| | | return $updated; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Increde/decrese messagecount for a specific folder |
| | | */ |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove messagecount of a specific folder from cache |
| | | */ |
| | |
| | | $this->update_cache('messagecount', $a_folder_cache); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts date string/object into IMAP date/time format |
| | |
| | | |
| | | return $date->format('d-M-Y H:i:s O'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This is our own debug handler for the IMAP connection |
| | |
| | | { |
| | | return $this->expunge_folder($folder, $clear_cache); |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | ); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Object constructor. |
| | | * |
| | |
| | | $this->messages_table = $db->table_name('cache_messages', true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Cleanup actions (on shutdown). |
| | | */ |
| | |
| | | $this->save_icache(); |
| | | $this->icache = null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set cache mode |
| | |
| | | { |
| | | $this->mode = $mode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return (sorted) messages index (UIDs). |
| | |
| | | return $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return messages thread. |
| | | * If threaded index doesn't exist or is invalid, will be updated. |
| | |
| | | |
| | | return $index['object']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns list of messages (headers). See rcube_imap::fetch_headers(). |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns message data. |
| | |
| | | |
| | | return $message; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves the message in cache. |
| | |
| | | $this->db->set_option('ignore_key_errors', false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets the flag for specified message. |
| | | * |
| | |
| | | $this->userid, $mailbox); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Removes message(s) from cache. |
| | | * |
| | |
| | | $this->userid, $mailbox); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears index cache. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears thread cache. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Clears the cache. |
| | | * |
| | |
| | | $this->remove_thread($mailbox); |
| | | $this->remove_message($mailbox, $uids); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete expired cache entries |
| | |
| | | $db->query("DELETE FROM ".$db->table_name('cache_thread', true) |
| | | ." WHERE `expires` < $now"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches index data from database |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches thread data from database |
| | | */ |
| | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves index data into database |
| | |
| | | $this->db->set_option('ignore_key_errors', false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves thread data into database |
| | | */ |
| | |
| | | |
| | | $this->db->set_option('ignore_key_errors', false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks index/thread validity |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Synchronizes the mailbox. |
| | |
| | | $this->icache[$mailbox]['index']['object'] = $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts cache row into message object. |
| | | * |
| | |
| | | return $message; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Saves message stored in internal cache |
| | | */ |
| | |
| | | $this->icache['__message']['md5sum'] = $md5sum; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Prepares message object to be stored in database. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches index data from IMAP server |
| | | */ |
| | |
| | | return $index; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches thread data from IMAP server |
| | | */ |
| | |
| | | |
| | | return new rcube_result_thread($mailbox, '* THREAD'); |
| | | } |
| | | |
| | | } |
| | | |
| | | // for backward compat. |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2006-2013, The Roundcube Dev Team | |
| | |
| | | $this->_connect(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Establish a connection to the LDAP server |
| | | */ |
| | |
| | | return $this->ready; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Close connection to LDAP server |
| | | */ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns address book name |
| | | * |
| | |
| | | { |
| | | return $this->prop['name']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal list page |
| | |
| | | $this->ldap->set_vlv_page($this->list_page, $this->page_size); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal sort settings |
| | | * |
| | |
| | | $this->sort_col = $this->coltypes[$sort_col]['attributes'][0]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Save a search string for future listings |
| | | * |
| | |
| | | { |
| | | $this->filter = $filter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for saved search properties |
| | |
| | | return $this->filter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reset all saved results and search parameters |
| | | */ |
| | |
| | | $this->ldap_result = null; |
| | | $this->filter = ''; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * List the current set of contact records |
| | |
| | | return strcmp($a[$this->sort_col][0], $b[$this->sort_col][0]); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Search contacts |
| | | * |
| | |
| | | return $this->result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Count number of available contacts in database |
| | | * |
| | |
| | | |
| | | return new rcube_result_set($count, ($this->list_page-1) * $this->page_size); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the last result set |
| | |
| | | |
| | | return $err; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check the given data before saving. |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create a new contact record |
| | | * |
| | |
| | | |
| | | return $dn; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Update a specific contact record |
| | |
| | | return $newdn ? $newdn : true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Mark one or more contact records as deleted |
| | | * |
| | |
| | | |
| | | return count($ids); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove all contact records |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts LDAP entry into an array |
| | | */ |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return LDAP attribute(s) for the given field |
| | | */ |
| | |
| | | { |
| | | return (array)$this->coltypes[$field]['attributes']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert a record data set into LDAP field attributes |
| | |
| | | return $default; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * HTML-safe DN string encoding |
| | | * |
| | |
| | | $str = str_pad(strtr($str, '-_', '+/'), strlen($str) % 4, '=', STR_PAD_RIGHT); |
| | | return base64_decode($str); |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | Roundcube/rcube_ldap_generic.php | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2014, The Roundcube Dev Team | |
| | |
| | | $this->app->plugins->exec_hook('message_load', array('object' => $this)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return a (decoded) message header |
| | | * |
| | |
| | | return $this->headers->get($name, !$raw); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set is_safe var and session data |
| | | * |
| | |
| | | { |
| | | $_SESSION['safe_messages'][$this->folder.':'.$this->uid] = $this->is_safe = $safe; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Compose a valid URL for getting a message part |
| | |
| | | else |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get content of a specific part of this message |
| | |
| | | NULL, $fp, $skip_charset_conv, $max_bytes, $formatted); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get content of a specific part of this message |
| | |
| | | return $body; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Format text message part for display |
| | | * |
| | |
| | | |
| | | return $body; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Determine if the message contains a HTML part. This must to be |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Determine if the message contains a text/plain part. This must to be |
| | | * a real part not an attachment (or its part) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the first HTML part of this message |
| | | * |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the first text part of this message |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks if part of the message is an attachment (or part of it) |
| | | * |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Read the message structure returend by the IMAP server |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fill aflat array with references to all parts, indexed by part numbers |
| | | * |
| | |
| | | for ($i=0; $i<count($part->parts); $i++) |
| | | $this->get_mime_numbers($part->parts[$i]); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Decode a Microsoft Outlook TNEF part (winmail.dat) |
| | |
| | | |
| | | return $parts; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Parse message body for UUencoded attachments bodies |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | */ |
| | | public $mimetype = 'text/plain'; |
| | | |
| | | public $disposition = ''; |
| | | public $filename = ''; |
| | | public $encoding = '8bit'; |
| | | public $charset = ''; |
| | | |
| | | /** |
| | | * Part size in bytes |
| | | * |
| | |
| | | */ |
| | | public $headers = array(); |
| | | |
| | | public $disposition = ''; |
| | | public $filename = ''; |
| | | public $encoding = '8bit'; |
| | | public $charset = ''; |
| | | public $d_parameters = array(); |
| | | public $ctype_parameters = array(); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube PHP suite | |
| | | | Copyright (C) 2005-2014 The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2014, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2011, The Roundcube Dev Team | |
| | |
| | | $this->mailbox = $mailbox; |
| | | $this->init($data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initializes object with SORT command response |
| | |
| | | $this->raw_data = $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks the result from IMAP command |
| | | * |
| | |
| | | return $this->raw_data === null ? true : false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks if the result is empty |
| | | * |
| | |
| | | { |
| | | return empty($this->raw_data) ? true : false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns number of elements in the result |
| | |
| | | return $this->meta['count']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns number of elements in the result. |
| | | * Alias for count() for compatibility with rcube_result_thread |
| | |
| | | { |
| | | return $this->count(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns maximal message identifier in the result |
| | |
| | | return $this->meta['max']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns minimal message identifier in the result |
| | | * |
| | |
| | | return $this->meta['min']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Slices data set. |
| | | * |
| | | * @param $offset Offset (as for PHP's array_slice()) |
| | | * @param $length Number of elements (as for PHP's array_slice()) |
| | | * |
| | | */ |
| | | public function slice($offset, $length) |
| | | { |
| | |
| | | $this->meta['count'] = count($data); |
| | | $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Filters data set. Removes elements not listed in $ids list. |
| | |
| | | $this->meta['count'] = count($data); |
| | | $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reverts order of elements in the result |
| | |
| | | |
| | | $this->meta['pos'] = array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if the given message ID exists in the object |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return all messages in the result. |
| | | * |
| | |
| | | return explode(self::SEPARATOR_ELEMENT, $this->raw_data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return all messages in the result. |
| | | * |
| | |
| | | |
| | | return rcube_imap_generic::compressMessageSet($this->get()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return result element at specified index |
| | |
| | | return $data[$index]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns response parameters, e.g. ESEARCH's MIN/MAX/COUNT/ALL/MODSEQ |
| | | * or internal data e.g. MAILBOX, ORDER |
| | |
| | | |
| | | return $params; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns length of internal data representation |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2011, The Roundcube Dev Team | |
| | |
| | | $this->folders = $folders; |
| | | $this->meta = array('count' => 0); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initializes object with SORT command response |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks if the result is empty |
| | | * |
| | |
| | | { |
| | | return empty($this->sets) || $this->meta['count'] == 0; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns number of elements in the result |
| | |
| | | return $this->meta['count']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns number of elements in the result. |
| | | * Alias for count() for compatibility with rcube_result_thread |
| | |
| | | { |
| | | return $this->count(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reverts order of elements in the result |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if the given message ID exists in the object |
| | | * |
| | |
| | | |
| | | return array_search($msgid, $this->index); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Filters data set. Removes elements listed in $ids list. |
| | |
| | | return $this->index; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return all messages in the result. |
| | | * |
| | |
| | | { |
| | | return ''; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return result element at specified index |
| | |
| | | default: return $this->index[$idx]; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns response parameters, e.g. ESEARCH's MIN/MAX/COUNT/ALL/MODSEQ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2006-2013, The Roundcube Dev Team | |
| | |
| | | { |
| | | return isset($this->records[$this->current]); |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2011, The Roundcube Dev Team | |
| | |
| | | $this->init($data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Initializes object with IMAP command response |
| | | * |
| | |
| | | $this->raw_data = $this->parse_thread($data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks the result from IMAP command |
| | | * |
| | |
| | | return $this->raw_data === null ? true : false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks if the result is empty |
| | | * |
| | |
| | | { |
| | | return empty($this->raw_data) ? true : false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns number of elements (threads) in the result |
| | |
| | | |
| | | return $this->meta['count']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns number of all messages in the result |
| | |
| | | return $this->meta['messages']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns maximum message identifier in the result |
| | | * |
| | |
| | | return $this->meta['max']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns minimum message identifier in the result |
| | | * |
| | |
| | | } |
| | | return $this->meta['min']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Slices data set. |
| | |
| | | $this->meta['count'] = count($data); |
| | | $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Filters data set. Removes threads not listed in $roots list. |
| | |
| | | $this->raw_data = ltrim($result, self::SEPARATOR_ELEMENT); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reverts order of elements in the result |
| | | */ |
| | |
| | | |
| | | $this->raw_data = rtrim($result, self::SEPARATOR_ELEMENT); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if the given message ID exists in the object |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return IDs of all messages in the result. Threaded data will be flattened. |
| | | * |
| | |
| | | return preg_split($regexp, $this->raw_data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return all messages in the result. |
| | | * |
| | |
| | | |
| | | return rcube_imap_generic::compressMessageSet($this->get()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return result element at specified index (all messages, not roots) |
| | |
| | | return $data[$index]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns response parameters e.g. MAILBOX, ORDER |
| | | * |
| | |
| | | |
| | | return $params; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * THREAD=REFS sorting implementation (based on provided index) |
| | |
| | | $this->raw_data = implode(self::SEPARATOR_ELEMENT, $result); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns data as tree |
| | | * |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns thread depth and children data |
| | | * |
| | |
| | | return array($depth, $children); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Creates 'depth' and 'children' arrays from stored thread 'tree' data. |
| | | */ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts part of the raw thread into an array |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * IMAP THREAD response parser |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | |
| | | */ |
| | | abstract class rcube_session |
| | | { |
| | | protected $config; |
| | | protected $key; |
| | | protected $ip; |
| | | protected $changed; |
| | | protected $start; |
| | | protected $vars; |
| | | protected $now; |
| | | protected $time_diff = 0; |
| | | protected $reloaded = false; |
| | | protected $appends = array(); |
| | | protected $unsets = array(); |
| | | protected $gc_handlers = array(); |
| | | protected $cookiename = 'roundcube_sessauth'; |
| | | protected $vars; |
| | | protected $now; |
| | | protected $secret = ''; |
| | | protected $ip_check = false; |
| | | protected $logging = false; |
| | | protected $config; |
| | | |
| | | /** |
| | | * Blocks session data from being written to database. |
| | |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Wrapper for session_start() |
| | | */ |
| | |
| | | abstract function write($key, $vars); |
| | | abstract function update($key, $newvars, $oldvars); |
| | | |
| | | |
| | | /** |
| | | * session write handler. This calls the implementation methods for write/update after some initial checks. |
| | | * |
| | | * @param $key |
| | | * @param $vars |
| | | * |
| | | * @return bool |
| | | */ |
| | | public function sess_write($key, $vars) |
| | |
| | | return $this->write($key, $vars); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Wrapper for session_write_close() |
| | |
| | | $this->gc_handlers[] = $func; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Garbage collector handler to run on script shutdown |
| | | */ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Generate and set new session id |
| | |
| | | return $cache; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Append the given value to the certain node in the session data array |
| | | * |
| | |
| | | unset($this->unsets[$path]); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Unset a session variable |
| | | * |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Kill this session |
| | | */ |
| | |
| | | $this->destroy(session_id()); |
| | | rcube_utils::setcookie($this->cookiename, '-del-', time() - 60); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Re-read session data from storage backend |
| | |
| | | |
| | | return $data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Unserialize session data |
| | |
| | | return unserialize( 'a:' . $items . ':{' . $serialized . '}' ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Setter for session lifetime |
| | | */ |
| | |
| | | $this->now = $now - ($now % ($this->lifetime / 2)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for remote IP saved with this session |
| | | */ |
| | |
| | | { |
| | | return $this->ip; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Setter for cookie encryption secret |
| | |
| | | $this->secret = $secret; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Enable/disable IP check |
| | | */ |
| | |
| | | { |
| | | $this->ip_check = $check; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Setter for the cookie name used for session cookie |
| | |
| | | $this->cookiename = $cookiename; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check session authentication cookie |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set session authentication cookie |
| | | */ |
| | |
| | | rcube_utils::setcookie($this->cookiename, $this->cookie, 0); |
| | | $_COOKIE[$this->cookiename] = $this->cookie; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create session cookie from session data |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Handler for session_destroy() |
| | | * |
| | |
| | | |
| | | return !empty($this->vars) ? (string) $this->vars : ''; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * update session data |
| | |
| | | // just clean all old sessions when this GC is called |
| | | $this->db->query("DELETE FROM " . $this->db->table_name('session') |
| | | . " WHERE changed < " . $this->db->now(-$this->gc_enabled)); |
| | | $this->log("Session GC (DB): remove records < " . date('Y-m-d H:i:s', time() - $this->gc_enabled) . '; rows = ' . intval($this->db->affected_rows())); |
| | | } |
| | | |
| | | $this->log("Session GC (DB): remove records < " |
| | | . date('Y-m-d H:i:s', time() - $this->gc_enabled) |
| | | . '; rows = ' . intval($this->db->affected_rows())); |
| | | } |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Read session data from memcache |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | |
| | | $this->changed = $_SESSION['__MTIME']; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * read data from redis store |
| | | * |
| | |
| | | |
| | | return !empty($this->vars) ? (string) $this->vars : ''; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * write data to redis store |
| | |
| | | $ts = microtime(true); |
| | | |
| | | if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 3) { |
| | | $this->redis->setex($key, $this->lifetime + 60, serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $newvars))); |
| | | $data = serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $newvars)); |
| | | $this->redis->setex($key, $this->lifetime + 60, $data); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * write data to redis store |
| | |
| | | */ |
| | | public function write($key, $vars) |
| | | { |
| | | return $this->redis->setex($key, $this->lifetime + 60, serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $vars))); |
| | | $data = serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $vars)); |
| | | |
| | | return $this->redis->setex($key, $this->lifetime + 60, $data); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | */ |
| | | class rcube_smtp |
| | | { |
| | | private $conn = null; |
| | | private $conn; |
| | | private $response; |
| | | private $error; |
| | | private $anonymize_log = 0; |
| | |
| | | $this->conn = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This is our own debug handler for the SMTP connection |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | | |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | | |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | | |
| | |
| | | { |
| | | return $this->error; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | | |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | | |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2011-2013, Kolab Systems AG | |
| | |
| | | return $this->found() == 0; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Number of mispellings found (after check) |
| | | * |
| | |
| | | { |
| | | return count($this->matches); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns suggestions for the specified word |
| | |
| | | |
| | | return array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns misspelled words |
| | |
| | | return array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns checking result in XML (Googiespell) format |
| | | * |
| | |
| | | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns checking result (misspelled words with suggestions) |
| | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns error message |
| | | * |
| | |
| | | return $this->error ? $this->error : ($this->backend ? $this->backend->error() : false); |
| | | } |
| | | |
| | | |
| | | private function html2text($text) |
| | | { |
| | | $h2t = new rcube_html2text($text, false, true, 0); |
| | | return $h2t->get_text(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if the specified word is an exception accoring to |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Add a word to dictionary |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove a word from dictionary |
| | | * |
| | |
| | | $this->update_dict(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Update dictionary row in DB |
| | |
| | | $plugin['userid'], $plugin['language'], implode(' ', $plugin['dictionary'])); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get dictionary from DB |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | */ |
| | | abstract function connect($host, $user, $pass, $port = 143, $use_ssl = null); |
| | | |
| | | |
| | | /** |
| | | * Close connection. Usually done on script shutdown |
| | | */ |
| | | abstract function close(); |
| | | |
| | | |
| | | /** |
| | | * Checks connection state. |
| | |
| | | */ |
| | | abstract function is_connected(); |
| | | |
| | | |
| | | /** |
| | | * Check connection state, connect if not connected. |
| | | * |
| | | * @return bool Connection state. |
| | | */ |
| | | abstract function check_connection(); |
| | | |
| | | |
| | | /** |
| | | * Returns code of last error |
| | |
| | | */ |
| | | abstract function get_error_code(); |
| | | |
| | | |
| | | /** |
| | | * Returns message of last error |
| | | * |
| | |
| | | */ |
| | | abstract function get_error_str(); |
| | | |
| | | |
| | | /** |
| | | * Returns code of last command response |
| | | * |
| | | * @return int Response code (class constant) |
| | | */ |
| | | abstract function get_response_code(); |
| | | |
| | | |
| | | /** |
| | | * Set connection and class options |
| | |
| | | { |
| | | $this->options = array_merge($this->options, (array)$opt); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get connection/class option |
| | |
| | | return $this->options[$name]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Activate/deactivate debug mode. |
| | | * |
| | | * @param boolean $dbg True if conversation with the server should be logged |
| | | */ |
| | | abstract function set_debug($dbg = true); |
| | | |
| | | |
| | | /** |
| | | * Set default message charset. |
| | |
| | | { |
| | | $this->default_charset = $cs; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal folder reference. |
| | |
| | | $this->folder = $folder; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the currently used folder name |
| | | * |
| | |
| | | { |
| | | return $this->folder; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal list page number. |
| | |
| | | $this->list_page = (int) $page; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets internal list page number. |
| | | * |
| | |
| | | { |
| | | return $this->list_page; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal page size |
| | |
| | | $this->page_size = (int) $size; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get internal page size |
| | | * |
| | |
| | | return $this->page_size; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Save a search result for future message listing methods. |
| | | * |
| | |
| | | */ |
| | | abstract function set_search_set($set); |
| | | |
| | | |
| | | /** |
| | | * Return the saved search set. |
| | | * |
| | | * @return array Search set in driver specific format, NULL if search wasn't initialized |
| | | */ |
| | | abstract function get_search_set(); |
| | | |
| | | |
| | | /** |
| | | * Returns the storage server's (IMAP) capability |
| | |
| | | * @return mixed Capability value or TRUE if supported, FALSE if not |
| | | */ |
| | | abstract function get_capability($cap); |
| | | |
| | | |
| | | /** |
| | | * Sets threading flag to the best supported THREAD algorithm. |
| | |
| | | return $this->threading; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get current threading flag. |
| | | * |
| | |
| | | { |
| | | return $this->threading; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks the PERMANENTFLAGS capability of the current folder |
| | |
| | | */ |
| | | abstract function check_permflag($flag); |
| | | |
| | | |
| | | /** |
| | | * Returns the delimiter that is used by the server |
| | | * for folder hierarchy separation. |
| | |
| | | * @return string Delimiter string |
| | | */ |
| | | abstract function get_hierarchy_delimiter(); |
| | | |
| | | |
| | | /** |
| | | * Get namespace |
| | |
| | | * @return array Namespace data |
| | | */ |
| | | abstract function get_namespace($name = null); |
| | | |
| | | |
| | | /** |
| | | * Get messages count for a specific folder. |
| | |
| | | */ |
| | | abstract function count($folder = null, $mode = 'ALL', $force = false, $status = true); |
| | | |
| | | |
| | | /** |
| | | * Public method for listing message flags |
| | | * |
| | |
| | | * @return array Indexed array with message flags |
| | | */ |
| | | abstract function list_flags($folder, $uids, $mod_seq = null); |
| | | |
| | | |
| | | /** |
| | | * Public method for listing headers. |
| | |
| | | */ |
| | | abstract function list_messages($folder = null, $page = null, $sort_field = null, $sort_order = null, $slice = 0); |
| | | |
| | | |
| | | /** |
| | | * Return sorted list of message UIDs |
| | | * |
| | |
| | | * @return rcube_result_index|rcube_result_thread List of messages (UIDs) |
| | | */ |
| | | abstract function index($folder = null, $sort_field = null, $sort_order = null); |
| | | |
| | | |
| | | /** |
| | | * Invoke search request to the server. |
| | |
| | | */ |
| | | abstract function search($folder = null, $str = 'ALL', $charset = null, $sort_field = null); |
| | | |
| | | |
| | | /** |
| | | * Direct (real and simple) search request (without result sorting and caching). |
| | | * |
| | |
| | | * @return rcube_result_index Search result (UIDs) |
| | | */ |
| | | abstract function search_once($folder = null, $str = 'ALL'); |
| | | |
| | | |
| | | /** |
| | | * Refresh saved search set |
| | |
| | | */ |
| | | abstract function get_message($uid, $folder = null); |
| | | |
| | | |
| | | /** |
| | | * Return message headers object of a specific message |
| | | * |
| | |
| | | * @return rcube_message_header Message headers |
| | | */ |
| | | abstract function get_message_headers($uid, $folder = null, $force = false); |
| | | |
| | | |
| | | /** |
| | | * Fetch message body of a specific message from the server |
| | |
| | | * @return string Message/part body if not printed |
| | | */ |
| | | abstract function get_message_part($uid, $part = 1, $o_part = null, $print = null, $fp = null, $skip_charset_conv = false); |
| | | |
| | | |
| | | /** |
| | | * Fetch message body of a specific message from the server |
| | |
| | | $headers->charset ? $headers->charset : $this->default_charset); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the whole message source as string (or saves to a file) |
| | | * |
| | |
| | | */ |
| | | abstract function get_raw_body($uid, $fp = null, $part = null); |
| | | |
| | | |
| | | /** |
| | | * Returns the message headers as string |
| | | * |
| | |
| | | */ |
| | | abstract function get_raw_headers($uid, $part = null); |
| | | |
| | | |
| | | /** |
| | | * Sends the whole message source to stdout |
| | | * |
| | |
| | | * @param bool $formatted Enables line-ending formatting |
| | | */ |
| | | abstract function print_raw_body($uid, $formatted = true); |
| | | |
| | | |
| | | /** |
| | | * Set message flag to one or several messages |
| | |
| | | * @return bool Operation status |
| | | */ |
| | | abstract function set_flag($uids, $flag, $folder = null, $skip_cache = false); |
| | | |
| | | |
| | | /** |
| | | * Remove message flag for one or several messages |
| | |
| | | return $this->set_flag($uids, 'UN'.$flag, $folder); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Append a mail message (source) to a specific folder. |
| | | * |
| | |
| | | */ |
| | | abstract function save_message($folder, &$message, $headers = '', $is_file = false, $flags = array(), $date = null); |
| | | |
| | | |
| | | /** |
| | | * Move message(s) from one folder to another. |
| | | * |
| | |
| | | * @return boolean True on success, False on error |
| | | */ |
| | | abstract function move_message($uids, $to, $from = null); |
| | | |
| | | |
| | | /** |
| | | * Copy message(s) from one mailbox to another. |
| | |
| | | */ |
| | | abstract function copy_message($uids, $to, $from = null); |
| | | |
| | | |
| | | /** |
| | | * Mark message(s) as deleted and expunge. |
| | | * |
| | |
| | | * @return boolean True on success, False on error |
| | | */ |
| | | abstract function delete_message($uids, $folder = null); |
| | | |
| | | |
| | | /** |
| | | * Expunge message(s) and clear the cache. |
| | |
| | | * @return boolean True on success, False on error |
| | | */ |
| | | abstract function expunge_message($uids, $folder = null, $clear_cache = true); |
| | | |
| | | |
| | | /** |
| | | * Parse message UIDs input |
| | |
| | | */ |
| | | abstract function list_folders_subscribed($root = '', $name = '*', $filter = null, $rights = null, $skip_sort = false); |
| | | |
| | | |
| | | /** |
| | | * Get a list of all folders available on the server. |
| | | * |
| | |
| | | */ |
| | | abstract function list_folders($root = '', $name = '*', $filter = null, $rights = null, $skip_sort = false); |
| | | |
| | | |
| | | /** |
| | | * Subscribe to a specific folder(s) |
| | | * |
| | |
| | | */ |
| | | abstract function subscribe($folders); |
| | | |
| | | |
| | | /** |
| | | * Unsubscribe folder(s) |
| | | * |
| | |
| | | * @return boolean True on success |
| | | */ |
| | | abstract function unsubscribe($folders); |
| | | |
| | | |
| | | /** |
| | | * Create a new folder on the server. |
| | |
| | | */ |
| | | abstract function create_folder($folder, $subscribe = false); |
| | | |
| | | |
| | | /** |
| | | * Set a new name to an existing folder |
| | | * |
| | |
| | | */ |
| | | abstract function rename_folder($folder, $new_name); |
| | | |
| | | |
| | | /** |
| | | * Remove a folder from the server. |
| | | * |
| | |
| | | * @return boolean True on success, False on error |
| | | */ |
| | | abstract function delete_folder($folder); |
| | | |
| | | |
| | | /** |
| | | * Send expunge command and clear the cache. |
| | |
| | | return $this->expunge_message('*', $folder, $clear_cache); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove all messages in a folder.. |
| | | * |
| | |
| | | return $this->delete_message('*', $folder); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks if folder exists and is subscribed |
| | | * |
| | |
| | | */ |
| | | abstract function folder_exists($folder, $subscription = false); |
| | | |
| | | |
| | | /** |
| | | * Get folder size (size of all messages in a folder) |
| | | * |
| | |
| | | */ |
| | | abstract function folder_size($folder); |
| | | |
| | | |
| | | /** |
| | | * Returns the namespace where the folder is in |
| | | * |
| | |
| | | * @return string One of 'personal', 'other' or 'shared' |
| | | */ |
| | | abstract function folder_namespace($folder); |
| | | |
| | | |
| | | /** |
| | | * Gets folder attributes (from LIST response, e.g. \Noselect, \Noinferiors). |
| | |
| | | */ |
| | | abstract function folder_attributes($folder, $force = false); |
| | | |
| | | |
| | | /** |
| | | * Gets connection (and current folder) data: UIDVALIDITY, EXISTS, RECENT, |
| | | * PERMANENTFLAGS, UIDNEXT, UNSEEN |
| | |
| | | */ |
| | | abstract function folder_data($folder); |
| | | |
| | | |
| | | /** |
| | | * Returns extended information about the folder. |
| | | * |
| | |
| | | * @return array Data |
| | | */ |
| | | abstract function folder_info($folder); |
| | | |
| | | |
| | | /** |
| | | * Returns current status of a folder (compared to the last time use) |
| | |
| | | */ |
| | | abstract function folder_status($folder = null, &$diff = array()); |
| | | |
| | | |
| | | /** |
| | | * Synchronizes messages cache. |
| | | * |
| | | * @param string $folder Folder name |
| | | */ |
| | | abstract function folder_sync($folder); |
| | | |
| | | |
| | | /** |
| | | * Modify folder name according to namespace. |
| | |
| | | * @return string Folder name |
| | | */ |
| | | abstract function mod_folder($folder, $mode = 'out'); |
| | | |
| | | |
| | | /** |
| | | * Create all folders specified as default |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if specified folder is a special folder |
| | | */ |
| | |
| | | { |
| | | return $name == 'INBOX' || in_array($name, $this->get_special_folders()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return configured special folders |
| | |
| | | return $this->icache['special-folders']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set special folder associations stored in backend |
| | | */ |
| | |
| | | // should be overriden by storage class if backend supports special folders (SPECIAL-USE) |
| | | unset($this->icache['special-folders']); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get mailbox quota information. |
| | |
| | | */ |
| | | abstract function set_acl($folder, $user, $acl); |
| | | |
| | | |
| | | /** |
| | | * Removes any <identifier,rights> pair for the |
| | | * specified user from the ACL for the specified |
| | |
| | | */ |
| | | abstract function delete_acl($folder, $user); |
| | | |
| | | |
| | | /** |
| | | * Returns the access control list for a folder (GETACL). |
| | | * |
| | |
| | | * @return array User-rights array on success, NULL on error |
| | | */ |
| | | abstract function get_acl($folder); |
| | | |
| | | |
| | | /** |
| | | * Returns information about what rights can be granted to the |
| | |
| | | */ |
| | | abstract function list_rights($folder, $user); |
| | | |
| | | |
| | | /** |
| | | * Returns the set of rights that the current user has to a folder (MYRIGHTS). |
| | | * |
| | |
| | | * @return array MYRIGHTS response on success, NULL on error |
| | | */ |
| | | abstract function my_rights($folder); |
| | | |
| | | |
| | | /** |
| | | * Sets metadata/annotations (SETMETADATA/SETANNOTATION) |
| | |
| | | */ |
| | | abstract function set_metadata($folder, $entries); |
| | | |
| | | |
| | | /** |
| | | * Unsets metadata/annotations (SETMETADATA/SETANNOTATION) |
| | | * |
| | |
| | | * @return boolean True on success, False on failure |
| | | */ |
| | | abstract function delete_metadata($folder, $entries); |
| | | |
| | | |
| | | /** |
| | | * Returns folder metadata/annotations (GETMETADATA/GETANNOTATION). |
| | |
| | | * @return array Metadata entry-value hash array on success, NULL on error |
| | | */ |
| | | abstract function get_metadata($folder, $entries, $options = array()); |
| | | |
| | | |
| | | /* ----------------------------------------- |
| | | * Cache related functions |
| | |
| | | */ |
| | | abstract function clear_cache($key = null, $prefix_mode = false); |
| | | |
| | | |
| | | /** |
| | | * Returns cached value |
| | | * |
| | |
| | | */ |
| | | abstract function get_cache($key); |
| | | |
| | | |
| | | /** |
| | | * Delete outdated cache entries |
| | | */ |
| | | abstract function cache_gc(); |
| | | |
| | | } // end class rcube_storage |
| | | } |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2009-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2014, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2014, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2012, The Roundcube Dev Team | |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Validates IPv4 or IPv6 address |
| | | * |
| | |
| | | return @inet_pton($ip) !== false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check whether the HTTP referer matches the current request |
| | | * |
| | |
| | | $referer = parse_url(self::request_header('Referer')); |
| | | return $referer['host'] == self::request_header('Host') && $referer['path'] == $uri['path']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Replacing specials characters to a specific encoding type |
| | |
| | | return $str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Read input value and convert it for internal use |
| | | * Performs stripslashes() and charset conversion if necessary |
| | |
| | | |
| | | return self::parse_input_value($value, $allow_html, $charset); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Parse/validate input value. See self::get_input_value() |
| | |
| | | return $value; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert array of request parameters (prefixed with _) |
| | | * to a regular array with non-prefixed keys. |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert the given string into a valid HTML identifier |
| | | * Same functionality as done in app.js with rcube_webmail.html_identifier() |
| | |
| | | return asciiwords($str, true, '_'); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Replace all css definitions with #container [def] |
| | |
| | | return $source; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Generate CSS classes from mimetype and filename extension |
| | | * |
| | |
| | | return join(" ", $classes); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Decode escaped entities used by known XSS exploits. |
| | | * See http://downloads.securityfocus.com/vulnerabilities/exploits/26800.eml for examples |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * preg_replace_callback callback for xss_entity_decode |
| | | * |
| | |
| | | { |
| | | return chr(hexdec($matches[1])); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if we can process not exceeding memory_limit |
| | |
| | | |
| | | return $mem_limit > 0 && $memory + $need > $mem_limit ? false : true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check if working in SSL mode |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Replaces hostname variables. |
| | |
| | | return str_replace(array('%n', '%t', '%d', '%h', '%z', '%s'), array($n, $t, $d, $h, $z, $s[2]), $name); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns remote IP address and forwarded addresses if found |
| | | * |
| | |
| | | |
| | | return $address; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the real remote IP address |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Improved equivalent to strtotime() |
| | |
| | | return self::idn_convert($str, true); |
| | | } |
| | | |
| | | |
| | | /* |
| | | * Idn_to_ascii wrapper. |
| | | * Intl/Idn modules version of this function doesn't work with e-mail address |
| | |
| | | { |
| | | return self::idn_convert($str, false); |
| | | } |
| | | |
| | | |
| | | public static function idn_convert($input, $is_utf=false) |
| | | { |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2012, The Roundcube Dev Team | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/copy.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/delete.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/edit.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/export.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/func.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/groups.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/import.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/list.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/mailto.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/move.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/photo.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/print.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/save.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/search.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/show.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/undo.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/addressbook/upload_photo.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/addcontact.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/attachments.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/autocomplete.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/check_recent.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/compose.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/copy.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/folders.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/func.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/get.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/getunread.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/headers.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/import.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/list.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/list_contacts.inc | |
| | | | | |
| | |
| | | <?php |
| | | /* |
| | | |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/mark.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/move_del.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/pagenav.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | steps/mail/search.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/search_contacts.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/sendmail.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/sendmdn.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/show.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/viewsource.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/about.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/edit_folder.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/edit_identity.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/edit_prefs.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/edit_response.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/folders.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/func.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/identities.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/responses.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/save_folder.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/save_identity.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/save_prefs.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/upload.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/error.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/html2text.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/killcache.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/modcss.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/save_pref.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/spell.inc | |
| | | | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/spell_html.inc | |
| | | | | |
| | |
| | | | Author: Aleksander Machniak <alec@alec.pl> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | $method = rcube_utils::get_input_value('method', rcube_utils::INPUT_POST); |
| | | $lang = rcube_utils::get_input_value('lang', rcube_utils::INPUT_POST); |
| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/utils/text2html.inc | |
| | | | | |