summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-05-18 10:25:29 +0000
committeralecpl <alec@alec.pl>2010-05-18 10:25:29 +0000
commit677e1f26fe47cc0c3e0819cb99a9024af49a619c (patch)
tree91074d603179889ba7fbde9d080c85ed62b27846 /program/steps/mail
parentcaccd193c8403913d7c77d65363ff6e4d4269dfb (diff)
- Some files from /bin + spellchecking actions moved to the new 'utils' task
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/compose.inc3
-rw-r--r--program/steps/mail/func.inc5
-rw-r--r--program/steps/mail/spell.inc28
-rw-r--r--program/steps/mail/spell_googie.inc73
-rw-r--r--program/steps/mail/spell_pspell.inc78
5 files changed, 4 insertions, 183 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index bc7cd8960..97541da91 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -555,7 +555,7 @@ function rcmail_compose_body($attrib)
$OUTPUT->include_script('googiespell.js');
$OUTPUT->add_script(sprintf(
- "var googie = new GoogieSpell('\$__skin_path/images/googiespell/','%s&_action=spell&lang=');\n".
+ "var googie = new GoogieSpell('\$__skin_path/images/googiespell/','?_task=utils&_action=spell&lang=');\n".
"googie.lang_chck_spell = \"%s\";\n".
"googie.lang_rsm_edt = \"%s\";\n".
"googie.lang_close = \"%s\";\n".
@@ -566,7 +566,6 @@ function rcmail_compose_body($attrib)
"googie.setSpellContainer('spellcheck-control');\n".
"googie.decorateTextarea('%s');\n".
"%s.set_env('spellcheck', googie);",
- $RCMAIL->comm_path,
JQ(Q(rcube_label('checkspelling'))),
JQ(Q(rcube_label('resumeediting'))),
JQ(Q(rcube_label('close'))),
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 00a8edf95..951e777b1 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -27,7 +27,7 @@ $SEARCH_MODS_DEFAULT = array('*' => array('subject'=>1, 'from'=>1), $SENT_MBOX =
$EMAIL_ADDRESS_PATTERN = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9][a-z0-9\-\.]*\\.[a-z]{2,5})';
// actions that do not require imap connection
-$NOIMAP_ACTIONS = array('spell', 'addcontact', 'autocomplete', 'upload', 'display-attachment', 'remove-attachment');
+$NOIMAP_ACTIONS = array('addcontact', 'autocomplete', 'upload', 'display-attachment', 'remove-attachment');
// always instantiate imap object (but not yet connect to server)
$RCMAIL->imap_init();
@@ -1068,7 +1068,8 @@ function rcmail_alter_html_link($matches)
$end = '>';
if ($tag == 'link' && preg_match('/^https?:\/\//i', $attrib['href'])) {
- $attrib['href'] = "./bin/modcss.php?u=" . urlencode($attrib['href']) . "&amp;c=" . urlencode($GLOBALS['rcmail_html_container_id']);
+ $attrib['href'] = "?_task=utils&amp;_action=modcss&amp;u=" . urlencode($attrib['href'])
+ . "&amp;c=" . urlencode($GLOBALS['rcmail_html_container_id']);
$end = ' />';
}
else if (preg_match('/^mailto:'.$EMAIL_ADDRESS_PATTERN.'(\?[^"\'>]+)?/i', $attrib['href'], $mailto)) {
diff --git a/program/steps/mail/spell.inc b/program/steps/mail/spell.inc
deleted file mode 100644
index a567c7bf6..000000000
--- a/program/steps/mail/spell.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/*
- +-----------------------------------------------------------------------+
- | program/steps/mail/spell.inc |
- | |
- | This file is part of the RoundCube Webmail client |
- | Licensed under the GNU GPL |
- | |
- | PURPOSE: |
- | Invoke the configured or default spell checking engine. |
- | |
- +-----------------------------------------------------------------------+
- | Author: Kris Steinhoff <steinhof@umich.edu> |
- +-----------------------------------------------------------------------+
-
- $Id$
-
-*/
-
-if ($spell_engine = $RCMAIL->config->get('spellcheck_engine', 'googie')) {
- include('spell_'.$spell_engine.'.inc');
-}
-
-header('HTTP/1.1 404 Not Found');
-exit;
-
-?>
diff --git a/program/steps/mail/spell_googie.inc b/program/steps/mail/spell_googie.inc
deleted file mode 100644
index f3b1c684d..000000000
--- a/program/steps/mail/spell_googie.inc
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-/*
- +-----------------------------------------------------------------------+
- | program/steps/mail/spell.inc |
- | |
- | This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
- | Licensed under the GNU GPL |
- | |
- | PURPOSE: |
- | Submit request to Google's spell checking engine |
- | |
- | CREDITS: |
- | Script from GoogieSpell by amix.dk |
- | |
- +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com> |
- +-----------------------------------------------------------------------+
-
- $Id$
-
-*/
-
-$REMOTE_REQUEST = TRUE;
-
-// default settings
-$host = "ssl://www.google.com";
-$port = 443;
-$lang = get_input_value('lang', RCUBE_INPUT_GET);
-$path = "/tbproxy/spell?lang=$lang";
-
-// spell check uri is configured
-if (!empty($CONFIG['spellcheck_uri']))
- {
- $a_uri = parse_url($CONFIG['spellcheck_uri']);
- $ssl = ($a_uri['scheme']=='https' || $a_uri['scheme']=='ssl');
- $port = $a_uri['port'] ? $a_uri['port'] : ($ssl ? 443 : 80);
- $host = ($ssl ? 'ssl://' : '') . $a_uri['host'];
- $path = $a_uri['path'] . ($a_uri['query'] ? '?'.$a_uri['query'] : '') . $lang;
- }
-
-$data = file_get_contents('php://input');
-$store = "";
-
-if ($fp = fsockopen($host, $port, $errno, $errstr, 30))
- {
- $out = "POST $path HTTP/1.0\r\n";
- $out .= "Host: $host\r\n";
- $out .= "Content-Length: " . strlen($data) . "\r\n";
- $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $out .= "Connection: Close\r\n\r\n";
- $out .= $data;
- fwrite($fp, $out);
-
- while (!feof($fp))
- $store .= fgets($fp, 128);
- fclose($fp);
- }
-
-// remove headers
-$pos = strpos($store, '<?xml');
-$store = substr($store, $pos);
-
-// set response length
-header("Content-Length: " . strlen($store));
-
-// Don't use server's default Content-Type charset (#1486406)
-header("Content-Type: text/xml; charset=".RCMAIL_CHARSET);
-print $store;
-exit;
-
-?>
diff --git a/program/steps/mail/spell_pspell.inc b/program/steps/mail/spell_pspell.inc
deleted file mode 100644
index b443ed525..000000000
--- a/program/steps/mail/spell_pspell.inc
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/*
- +-----------------------------------------------------------------------+
- | program/steps/mail/spell_pspell.inc |
- | |
- | This file is part of the RoundCube Webmail client |
- | Licensed under the GNU GPL |
- | |
- | PURPOSE: |
- | Use the Pspell extension to check spelling, returns results |
- | compatible with spell_googie.inc. |
- | |
- +-----------------------------------------------------------------------+
- | Author: Kris Steinhoff <steinhof@umich.edu> |
- +-----------------------------------------------------------------------+
-
- $Id$
-
-*/
-
-if (!extension_loaded('pspell')) {
- raise_error(array(
- 'code' => 500,
- 'type' => 'php',
- 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Pspell extension not available"), true, false);
-
- header('HTTP/1.1 404 Not Found');
- exit;
-}
-
-// max. number of suggestions for one word
-define('MAX_SUGGESTIONS', 10);
-
-// read input
-$data = file_get_contents('php://input');
-
-// parse data (simplexml_load_string breaks CRLFs)
-$left = strpos($data, '<text>');
-$right = strrpos($data, '</text>');
-$text = substr($data, $left+6, $right-($left+6));
-$text = html_entity_decode($text, ENT_QUOTES, RCMAIL_CHARSET);
-
-// tokenize
-$words = preg_split('/[ !"#$%&()*+\\,\/\n:;<=>?@\[\]^_{|}-]+|\.[^\w]/', $text, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE );
-
-// init spellchecker
-$plink = pspell_new(get_input_value('lang', RCUBE_INPUT_GET), null, null, RCMAIL_CHARSET, PSPELL_FAST);
-
-// send output
-$out = '<?xml version="1.0" encoding="'.RCMAIL_CHARSET.'"?><spellresult charschecked="'.mb_strlen($text).'">';
-
-$diff = 0;
-foreach ($words as $w) {
- $word = trim($w[0]);
- $pos = $w[1] - $diff;
- $len = mb_strlen($word);
- if ($word && $plink && preg_match('/[^0-9\.]/', $word)
- && !pspell_check($plink, $word)) {
- $suggestions = pspell_suggest($plink, $word);
- if (sizeof($suggestions)>10)
- $suggestions = array_slice($suggestions, 0, MAX_SUGGESTIONS);
-
- $out .= '<c o="'.$pos.'" l="'.$len.'">';
- $out .= implode("\t", $suggestions);
- $out .= '</c>';
- }
- $diff += (strlen($word) - $len);
-}
-
-$out .= '</spellresult>';
-
-header("Content-Type: text/xml; charset=".RCMAIL_CHARSET);
-echo $out;
-exit;
-
-?>