Changeset 2209 in subversion
- Timestamp:
- Jan 1, 2009 1:02:59 PM (4 years ago)
- Location:
- branches/devel-api
- Files:
-
- 7 added
- 6 edited
-
config/main.inc.php.dist (modified) (1 diff)
-
index.php (modified) (3 diffs)
-
plugins (added)
-
plugins/autologon (added)
-
plugins/autologon/autologon.php (added)
-
plugins/emoticons (added)
-
plugins/emoticons/emoticons.php (added)
-
program/include/main.inc (modified) (1 diff)
-
program/include/rcmail.php (modified) (4 diffs)
-
program/include/rcube_config.php (modified) (1 diff)
-
program/include/rcube_plugin.php (added)
-
program/include/rcube_plugin_api.php (added)
-
program/steps/mail/func.inc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-api/config/main.inc.php.dist
r2195 r2209 35 35 // use this folder to store temp files (must be writeable for apache user) 36 36 $rcmail_config['temp_dir'] = 'temp/'; 37 38 // use this folder to search for plugin sources 39 $rcmail_config['plugins_dir'] = 'plugins/'; 40 41 // List of active plugins. Add the name of a directory found in 'plugins_dir' 42 $rcmail_config['plugins'] = array(); 37 43 38 44 // enable caching of messages and mailbox data in the local database. -
branches/devel-api/index.php
r2121 r2209 3 3 +-------------------------------------------------------------------------+ 4 4 | RoundCube Webmail IMAP Client | 5 | Version 0.2-200 80829|6 | | 7 | Copyright (C) 2005-200 8, RoundCube Dev. - Switzerland |5 | Version 0.2-20090101 | 6 | | 7 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland | 8 8 | | 9 9 | This program is free software; you can redistribute it and/or modify | … … 71 71 } 72 72 73 74 // trigger startup plugin hook 75 $startup = $RCMAIL->plugins->exec_hook('startup', array('task' => $RCMAIL->task, 'action' => $RCMAIL->action)); 76 $RCMAIL->set_task($startup['task']); 77 $RCMAIL->action = $startup['action']; 78 79 73 80 // try to log in 74 81 if ($RCMAIL->action=='login' && $RCMAIL->task=='mail') { 75 $host = $RCMAIL->autoselect_host(); 82 $auth = $RCMAIL->plugins->exec_hook('authenticate', array( 83 'host' => $RCMAIL->autoselect_host(), 84 'user' => trim(get_input_value('_user', RCUBE_INPUT_POST)), 85 )) + array('pass' => get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1')); 76 86 77 87 // check if client supports cookies … … 79 89 $OUTPUT->show_message("cookiesdisabled", 'warning'); 80 90 } 81 else if ($_SESSION['temp'] && !empty($_POST['_user']) && !empty($_POST['_pass']) && 82 $RCMAIL->login(trim(get_input_value('_user', RCUBE_INPUT_POST), ' '), 83 get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'), $host)) { 91 else if ($_SESSION['temp'] && !empty($auth['user']) && !empty($auth['host']) && isset($auth['pass']) && 92 $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'])) { 84 93 // create new session ID 85 94 unset($_SESSION['temp']); -
branches/devel-api/program/include/main.inc
r2187 r2209 296 296 function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE) 297 297 { 298 global $OUTPUT;299 298 static $html_encode_arr = false; 300 299 static $js_rep_table = false; 301 300 static $xml_rep_table = false; 302 301 303 $charset = $OUTPUT->get_charset();302 $charset = rcmail::get_instance()->config->get('charset', RCMAIL_CHARSET); 304 303 $is_iso_8859_1 = false; 305 304 if ($charset == 'ISO-8859-1') { -
branches/devel-api/program/include/rcmail.php
r2188 r2209 38 38 public $imap; 39 39 public $output; 40 public $plugins; 40 41 public $task = 'mail'; 41 42 public $action = ''; … … 48 49 * This implements the 'singleton' design pattern 49 50 * 50 * @return object qvertThe one and only instance51 * @return object rcmail The one and only instance 51 52 */ 52 53 static function get_instance() … … 89 90 openlog($syslog_id, LOG_ODELAY, $syslog_facility); 90 91 } 91 92 92 93 // set task and action properties 93 94 $this->set_task(strip_quotes(get_input_value('_task', RCUBE_INPUT_GPC))); … … 132 133 if ($this->task == 'mail') 133 134 $this->imap_init(); 135 136 // create plugin API and load plugins 137 $this->plugins = rcube_plugin_api::get_instance(); 134 138 } 135 139 -
branches/devel-api/program/include/rcube_config.php
r2126 r2209 75 75 $this->prop['log_dir'] = $this->prop['log_dir'] ? unslashify($this->prop['log_dir']) : INSTALL_PATH . 'logs'; 76 76 $this->prop['temp_dir'] = $this->prop['temp_dir'] ? unslashify($this->prop['temp_dir']) : INSTALL_PATH . 'temp'; 77 $this->prop['plugins_dir'] = $this->prop['plugins_dir'] ? unslashify($this->prop['plugins_dir']) : INSTALL_PATH . 'plugins'; 77 78 78 79 // fix default imap folders encoding -
branches/devel-api/program/steps/mail/func.inc
r2197 r2209 626 626 function rcmail_print_body($part, $p = array()) 627 627 { 628 global $REMOTE_OBJECTS; 629 630 $p += array('safe' => false, 'plain' => false, 'inline_html' => true); 628 global $RCMAIL, $REMOTE_OBJECTS; 629 630 // trigger plugin hook 631 $data = $RCMAIL->plugins->exec_hook('message-body-before', 632 array('type' => $part->ctype_secondary, 'body' => $part->body) + $p + array('safe' => false, 'plain' => false, 'inline_html' => true)); 631 633 632 634 // convert html to text/plain 633 if ($ part->ctype_secondary == 'html' && $p['plain']) {634 $txt = new html2text($ part->body, false, true);635 if ($data['type'] == 'html' && $data['plain']) { 636 $txt = new html2text($data['body'], false, true); 635 637 $body = $txt->get_text(); 636 638 $part->ctype_secondary = 'plain'; 637 639 } 638 640 // text/html 639 else if ($ part->ctype_secondary== 'html') {640 $html = $ part->body;641 else if ($data['type'] == 'html') { 642 $html = $data['body']; 641 643 642 644 // special replacements (not properly handled by washtml class) … … 676 678 $wash_opts = array( 677 679 'show_washed' => false, 678 'allow_remote' => $ p['safe'],680 'allow_remote' => $data['safe'], 679 681 'blocked_src' => "./program/blocked.gif", 680 682 'charset' => RCMAIL_CHARSET, … … 683 685 ); 684 686 685 if (!$ p['inline_html']) {687 if (!$data['inline_html']) { 686 688 $wash_opts['html_elements'] = array('html','head','title','body'); 687 689 } … … 696 698 $body = $washer->wash($html); 697 699 $REMOTE_OBJECTS = $washer->extlinks; 698 699 return $body;700 701 $part->ctype_secondary = $data['type']; 700 702 } 701 703 // text/enriched 702 else if ($ part->ctype_secondary=='enriched') {704 else if ($data['type'] == 'enriched') { 703 705 $part->ctype_secondary = 'html'; 704 return Q(enriched_to_html($part->body), 'show'); 705 } 706 else 706 $body = Q(enriched_to_html($data['body']), 'show'); 707 } 708 else { 709 // assert plaintext 710 $part->ctype_secondary = $data['type'] = 'plain'; 707 711 $body = $part->body; 708 709 710 /**** assert plaintext ****/ 711 712 // make links and email-addresses clickable 713 $convert_patterns = $convert_replaces = $replace_strings = array(); 714 715 $url_chars = 'a-z0-9_\-\+\*\$\/&%=@#:;'; 716 $url_chars_within = '\?\.~,!'; 717 718 $convert_patterns[] = "/([\w]+):\/\/([a-z0-9\-\.]+[a-z]{2,4}([$url_chars$url_chars_within]*[$url_chars])?)/ie"; 719 $convert_replaces[] = "rcmail_str_replacement('<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>', \$replace_strings)"; 720 721 $convert_patterns[] = "/([^\/:]|\s)(www\.)([a-z0-9\-]{2,}[a-z]{2,4}([$url_chars$url_chars_within]*[$url_chars])?)/ie"; 722 $convert_replaces[] = "rcmail_str_replacement('\\1<a href=\"http://\\2\\3\" target=\"_blank\">\\2\\3</a>', \$replace_strings)"; 723 724 $convert_patterns[] = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/ie'; 725 $convert_replaces[] = "rcmail_str_replacement('<a href=\"mailto:\\1\" onclick=\"return ".JS_OBJECT_NAME.".command(\'compose\',\'\\1\',this)\">\\1</a>', \$replace_strings)"; 726 727 // search for patterns like links and e-mail addresses 728 $body = preg_replace($convert_patterns, $convert_replaces, $body); 729 730 // split body into single lines 731 $a_lines = preg_split('/\r?\n/', $body); 732 $quote_level = 0; 733 734 // colorize quoted parts 735 for ($n=0; $n < sizeof($a_lines); $n++) { 736 $line = $a_lines[$n]; 737 $quotation = ''; 738 $q = 0; 739 740 if (preg_match('/^(>+\s*)+/', $line, $regs)) { 741 $q = strlen(preg_replace('/\s/', '', $regs[0])); 742 $line = substr($line, strlen($regs[0])); 743 744 if ($q > $quote_level) 745 $quotation = str_repeat('<blockquote>', $q - $quote_level); 746 else if ($q < $quote_level) 747 $quotation = str_repeat("</blockquote>", $quote_level - $q); 748 } 749 else if ($quote_level > 0) 750 $quotation = str_repeat("</blockquote>", $quote_level); 751 752 $quote_level = $q; 753 $a_lines[$n] = $quotation . Q($line, 'replace', false); // htmlquote plaintext 754 } 755 756 // insert the links for urls and mailtos 757 $body = preg_replace("/##string_replacement\{([0-9]+)\}##/e", "\$replace_strings[\\1]", join("\n", $a_lines)); 758 759 return html::tag('pre', array(), $body); 712 } 713 714 715 if ($part->ctype_secondary == 'plain') { 716 // make links and email-addresses clickable 717 $convert_patterns = $convert_replaces = $replace_strings = array(); 718 719 $url_chars = 'a-z0-9_\-\+\*\$\/&%=@#:;'; 720 $url_chars_within = '\?\.~,!'; 721 722 $convert_patterns[] = "/([\w]+):\/\/([a-z0-9\-\.]+[a-z]{2,4}([$url_chars$url_chars_within]*[$url_chars])?)/ie"; 723 $convert_replaces[] = "rcmail_str_replacement('<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>', \$replace_strings)"; 724 725 $convert_patterns[] = "/([^\/:]|\s)(www\.)([a-z0-9\-]{2,}[a-z]{2,4}([$url_chars$url_chars_within]*[$url_chars])?)/ie"; 726 $convert_replaces[] = "rcmail_str_replacement('\\1<a href=\"http://\\2\\3\" target=\"_blank\">\\2\\3</a>', \$replace_strings)"; 727 728 $convert_patterns[] = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/ie'; 729 $convert_replaces[] = "rcmail_str_replacement('<a href=\"mailto:\\1\" onclick=\"return ".JS_OBJECT_NAME.".command(\'compose\',\'\\1\',this)\">\\1</a>', \$replace_strings)"; 730 731 // search for patterns like links and e-mail addresses 732 $body = preg_replace($convert_patterns, $convert_replaces, $body); 733 734 // split body into single lines 735 $a_lines = preg_split('/\r?\n/', $body); 736 $quote_level = 0; 737 738 // colorize quoted parts 739 for ($n=0; $n < sizeof($a_lines); $n++) { 740 $line = $a_lines[$n]; 741 $quotation = ''; 742 $q = 0; 743 744 if (preg_match('/^(>+\s*)+/', $line, $regs)) { 745 $q = strlen(preg_replace('/\s/', '', $regs[0])); 746 $line = substr($line, strlen($regs[0])); 747 748 if ($q > $quote_level) 749 $quotation = str_repeat('<blockquote>', $q - $quote_level); 750 else if ($q < $quote_level) 751 $quotation = str_repeat("</blockquote>", $quote_level - $q); 752 } 753 else if ($quote_level > 0) 754 $quotation = str_repeat("</blockquote>", $quote_level); 755 756 $quote_level = $q; 757 $a_lines[$n] = $quotation . Q($line, 'replace', false); // htmlquote plaintext 758 } 759 760 // insert the links for urls and mailtos 761 $body = preg_replace("/##string_replacement\{([0-9]+)\}##/e", "\$replace_strings[\\1]", join("\n", $a_lines)); 762 } 763 764 // allow post-processing of the message body 765 $data = $RCMAIL->plugins->exec_hook('message-body-after', array('type' => $part->ctype_secondary, 'body' => $body) + $data); 766 767 return $data['type'] == 'html' ? $data['body'] : html::tag('pre', array(), $data['body']); 760 768 } 761 769
Note: See TracChangeset
for help on using the changeset viewer.
