View | Details | Raw Unified | Return to bug 241327
Collapse All | Expand All

(-)mail/roundcube/Makefile (-7 / +2 lines)
Lines 2-7 Link Here
2
2
3
PORTNAME=	roundcube
3
PORTNAME=	roundcube
4
DISTVERSION=	1.3.9
4
DISTVERSION=	1.3.9
5
PORTREVISION=	1
5
PORTEPOCH=	1
6
PORTEPOCH=	1
6
CATEGORIES?=	mail www
7
CATEGORIES?=	mail www
7
MASTER_SITES=	https://github.com/roundcube/roundcubemail/releases/download/${DISTVERSION}/
8
MASTER_SITES=	https://github.com/roundcube/roundcubemail/releases/download/${DISTVERSION}/
Lines 28-34 Link Here
28
29
29
USE_PHP=	pcre mbstring session iconv dom xml json intl zip filter openssl fileinfo exif
30
USE_PHP=	pcre mbstring session iconv dom xml json intl zip filter openssl fileinfo exif
30
31
31
OPTIONS_DEFINE=	LDAP GD PSPELL NSC DOCS EXAMPLES
32
OPTIONS_DEFINE=	LDAP GD PSPELL DOCS EXAMPLES
32
OPTIONS_MULTI=	DB
33
OPTIONS_MULTI=	DB
33
OPTIONS_MULTI_DB=	MYSQL PGSQL SQLITE
34
OPTIONS_MULTI_DB=	MYSQL PGSQL SQLITE
34
OPTIONS_DEFAULT=MYSQL
35
OPTIONS_DEFAULT=MYSQL
Lines 40-52 Link Here
40
LDAP_DESC=	Enable LDAP support (address book)
41
LDAP_DESC=	Enable LDAP support (address book)
41
GD_DESC=	Enable GD support (image conversion)
42
GD_DESC=	Enable GD support (image conversion)
42
PSPELL_DESC=	Enable PSpell support (internal spellcheck)
43
PSPELL_DESC=	Enable PSpell support (internal spellcheck)
43
NSC_DESC=	Install network spellchecker
44
44
45
GD_VARS=	use_php+=gd
45
GD_VARS=	use_php+=gd
46
LDAP_VARS=	use_php+=ldap
46
LDAP_VARS=	use_php+=ldap
47
MYSQL_VARS=	use_php+=pdo_mysql
47
MYSQL_VARS=	use_php+=pdo_mysql
48
NSC_IMPLIES=	PSPELL
49
NSC_VARS=	use_php+=simplexml rcubecomp+=spellchecker.php
50
PGSQL_VARS=	use_php+=pdo_pgsql
48
PGSQL_VARS=	use_php+=pdo_pgsql
51
PSPELL_VARS=	use_php+=pspell
49
PSPELL_VARS=	use_php+=pspell
52
SQLITE_VARS=	use_php+=pdo_sqlite
50
SQLITE_VARS=	use_php+=pdo_sqlite
Lines 53-61 Link Here
53
51
54
SUB_FILES=	newsyslog.conf
52
SUB_FILES=	newsyslog.conf
55
53
56
post-extract-NSC:
57
	@${CP} ${FILESDIR}/spellchecker.php ${WRKSRC}
58
59
post-patch:
54
post-patch:
60
	@${FIND} ${WRKSRC} -name \*.orig -type f -delete
55
	@${FIND} ${WRKSRC} -name \*.orig -type f -delete
61
56
(-)mail/roundcube/files/spellchecker.php (-53 lines)
Lines 1-53 Link Here
1
<?php
2
/*-
3
 * Copyright (c) 2006 Alex Dupre.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
$lang = $_REQUEST["lang"];
26
$xml = new SimpleXMLElement(file_get_contents("php://input"));
27
$spell = pspell_new($lang, "", "", "utf-8", PSPELL_NORMAL);
28
$suggestions = array();
29
$offset = 0;
30
mb_regex_encoding("UTF-8");
31
foreach (mb_split("\n", $xml->text) as $line) {
32
  $len = mb_strlen($line, "UTF-8");
33
  mb_ereg_search_init($line, "\w+");
34
  while (($wpos = mb_ereg_search_pos()) != FALSE) {
35
    $word = mb_substr($line, $wpos[0], $wpos[1]);
36
    if (!pspell_check($spell, $word)) {
37
      $woffset = mb_strlen(mb_substr($line, 0, $wpos[0]), "UTF-8");
38
      $wlen = mb_strlen($word, "UTF-8");
39
      array_push($suggestions, array($offset + $woffset, $wlen, pspell_suggest($spell, $word)));
40
    }
41
  }
42
  $offset += $len + 1;
43
}
44
$xml = new SimpleXMLElement("<spellresponse/>");
45
$xml->addAttribute("error", count($suggestions) ? "1" : "0");
46
foreach ($suggestions as $s) {
47
  $c = $xml->addChild("c", join("\t", $s[2]));
48
  $c->addAttribute("o", $s[0]);
49
  $c->addAttribute("l", $s[1]);
50
  $c->addAttribute("s", "1");
51
}
52
header('Content-Type: text/xml');
53
echo $xml->asXML();

Return to bug 241327