mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-17 13:33:19 +01:00
188 lines
12 KiB
Plaintext
188 lines
12 KiB
Plaintext
2010/02/13 (RalfBecker)
|
|
Reworked Jose's original aspell integration shown in Klaus' entry from 2008/10/09.
|
|
Aspell path and language is now read directly from the configuration and an active EGroupware session is required.
|
|
--- /tmp/fckeditor-2.6.4.1/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php 2009-07-06 10:10:02.000000000 +0200
|
|
+++ editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php 2010-02-13 04:18:18.000000000 +0100
|
|
@@ -3,11 +3,34 @@
|
|
|
|
// The following variables values must reflect your installation needs.
|
|
|
|
-$aspell_prog = '"C:\Program Files\Aspell\bin\aspell.exe"'; // by FredCK (for Windows)
|
|
+//$aspell_prog = '"C:\Program Files\Aspell\bin\aspell.exe"'; // by FredCK (for Windows)
|
|
//$aspell_prog = 'aspell'; // by FredCK (for Linux)
|
|
|
|
-$lang = 'en_US';
|
|
-$aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; // by FredCK
|
|
+// This is to prevent abitrary access to FCK's spellchecker.php AND to supply the configured path and lang
|
|
+function deny_no_egw_session(&$account)
|
|
+{
|
|
+ die('Access denied, no EGroupware session!');
|
|
+}
|
|
+$GLOBALS['egw_info'] = array(
|
|
+ 'flags' => array(
|
|
+ 'currentapp' => 'home',
|
|
+ 'noheader' => true,
|
|
+ 'autocreate_session_callback' => 'deny_no_egw_session',
|
|
+ )
|
|
+);
|
|
+// will not continue, unless the header get's included and there is a valid eGW session
|
|
+require('../../../../../../../../header.inc.php');
|
|
+
|
|
+if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['spellchecker_lang']))
|
|
+{
|
|
+ $lang = $GLOBALS['egw_info']['user']['preferences']['common']['spellchecker_lang'];
|
|
+}
|
|
+else
|
|
+{
|
|
+ $lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
|
|
+}
|
|
+
|
|
+$aspell_opts = '-a '.escapeshellarg('--lang='.$lang).' --encoding=utf-8 -H --rem-sgml-check=alt'; // by FredCK
|
|
|
|
$tempfiledir = "./";
|
|
|
|
@@ -69,14 +92,32 @@
|
|
## for each misspelled word, get suggestions and put in the javascript suggs array
|
|
function print_checker_results() {
|
|
|
|
- global $aspell_prog;
|
|
global $aspell_opts;
|
|
global $tempfiledir;
|
|
global $textinputs;
|
|
global $input_separator;
|
|
$aspell_err = "";
|
|
+
|
|
+ // check if admin enabled serverside (aspell based) spellchecker
|
|
+ if (!isset($GLOBALS['egw_info']['server']['enabled_spellcheck']))
|
|
+ {
|
|
+ error_handler('Spellchecker is NOT enabled in global EGroupware configuration (Admin >> Site configuration)!');
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (!empty($GLOBALS['egw_info']['server']['aspell_path']) &&
|
|
+ is_executable($GLOBALS['egw_info']['server']['aspell_path']))
|
|
+ {
|
|
+ $aspell_prog = $GLOBALS['egw_info']['server']['aspell_path'];
|
|
+ }
|
|
+ else // little fallback that might save linux users
|
|
+ {
|
|
+ $aspell_prog = 'aspell';
|
|
+ }
|
|
+
|
|
# create temp file
|
|
- $tempfile = tempnam( $tempfiledir, 'aspell_data_' );
|
|
+ // use EGroupware's temp_dir
|
|
+ $tempfile = tempnam( $GLOBALS['egw_info']['server']['temp_dir'], 'aspell_data_' );
|
|
|
|
# open temp file, add the submitted text.
|
|
if( $fh = fopen( $tempfile, 'w' )) {
|
|
|
|
2009/07/09 (KlausLeithoff)
|
|
after merging the vendor branch into the current release, remove _samples Directory, and unneeded connectors
|
|
-change to phpgwapi/js/fckeditor
|
|
svn remove --force _samples
|
|
-change to phpgwapi/js/fckeditor/editor/filemanager/connectors
|
|
svn remove --force asp aspx cfm lasso perl py
|
|
-remove baseconfigs for unneeded connectors
|
|
svn delete fckeditor.afp fckeditor.asp fckeditor.cfc fckeditor.cfm fckeditor.lasso fckeditor.pl fckeditor.py
|
|
|
|
2008/10/09 (KlausLeithoff)
|
|
-To use Speller Pages just set the following configuration in fckconfig.js or in your own Configuration File:
|
|
FCKConfig.SpellChecker = 'SpellerPages' ;
|
|
-editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
|
|
-SpellChecker integration (aspell configured path from egw)
|
|
from line 6 on ...
|
|
-----------------------------------------
|
|
-$aspell_prog = '"C:\Program Files\Aspell\bin\aspell.exe"'; // by FredCK (for Windows)
|
|
+//$aspell_prog = '"C:\Program Files\Aspell\bin\aspell.exe"'; // by FredCK (for Windows)
|
|
//$aspell_prog = 'aspell'; // by FredCK (for Linux)
|
|
-
|
|
-$lang = 'en_US';
|
|
+if ($_GET['aspell_path'])
|
|
+{
|
|
+ $aspell_prog = $_GET['aspell_path'];
|
|
+}
|
|
+else
|
|
+{
|
|
+ $aspell_prog = 'aspell';
|
|
+}
|
|
+
|
|
+if ($_GET['spellchecker_lang'])
|
|
+{
|
|
+ $lang = $_GET['spellchecker_lang'];
|
|
+}
|
|
+else
|
|
+{
|
|
+ $lang = 'en_US';
|
|
+}
|
|
$aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; // by FredCK
|
|
---------------------------------------
|
|
2008/04/15 (RalfBecker)
|
|
- update to FCK 2.6.3
|
|
- editor/filemanager/connectors/php/io.php line 184:
|
|
- return $info->filename . $info->path_info ;
|
|
+ // RalfBecker 2008/04/15: remove index.{html|php} added by apache
|
|
+ return str_replace(array('/index.html','/index.php'),'',$info->filename) . $info->path_info ;
|
|
|
|
- editor/filemanager/browser/default/connectors/php/config.php line 30:
|
|
$Config['Enabled'] = false ;
|
|
|
|
+function deny_no_egw_session(&$account)
|
|
+{
|
|
+ die('Access denied!');
|
|
+}
|
|
+$GLOBALS['egw_info'] = array(
|
|
+ 'flags' => array(
|
|
+ 'currentapp' => 'home',
|
|
+ 'noheader' => true,
|
|
+ 'autocreate_session_callback' => 'deny_no_egw_session',
|
|
+ )
|
|
+);
|
|
+// will not continue, unless the header get's included and there is a valid eGW session
|
|
+require('../../../../../../../header.inc.php');
|
|
+
|
|
+if ($GLOBALS['egw']->session->session_flags == 'N' && // allow only non anonymous sessions,
|
|
+ ($app=$GLOBALS['egw']->session->appsession($_GET['ServerPath'],'FCKeditor')) && // check if path is stored in the session and
|
|
+ isset($GLOBALS['egw_info']['user']['apps'][$app])) // user has access to the stored application (as we can only check of home above)
|
|
+{
|
|
+ $Config['UserFilesPath'] = $_GET['ServerPath'];
|
|
+ $Config['Enabled'] = true;
|
|
+}
|
|
+else
|
|
// Path to user files relative to the document root.
|
|
$Config['UserFilesPath'] = '/userfiles/' ;
|
|
|
|
- editor/filemanager/browser/default/connectors/php/config.php reverted to the original FCK version of ConfigAllowedTypes
|
|
-$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media') ;
|
|
+$Config['ConfigAllowedTypes'] = array('Image'); //array('File', 'Image', 'Flash', 'Media') ;
|
|
|
|
-$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ;
|
|
+$Config['FileTypesPath']['Image'] = $Config['UserFilesPath']; // . 'image/' ;
|
|
|
|
2007/12/16 (jgordor) - 2.5 Migration
|
|
- Moved own config (not controlled by the php config object) to external file: fckeditor.egwconfig.js
|
|
- Changes in the fckeditor code:
|
|
- Enable/configure the connector in (now is controlled by only one file):
|
|
- editor/filemanager/connectors/php/config.php
|
|
- Enable connector
|
|
- Get and set ServerPath var to configure userdir path
|
|
- Enable/configure aspell on (for spellchecker):
|
|
- editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
|
|
|
|
--------------------------------------------------------
|
|
Changes made to fckeditor to work properly on egroupware
|
|
- fckconfig.js
|
|
- Added egw_* toolbars
|
|
- editor/filemanager/browser/default/connectors/php/connector.php
|
|
- Change hardcoded image dir from Image -> images (to respect the actual behavior in sitemgr)
|
|
- editor/filemanager/browser/default/frmresourcetype.html
|
|
- Again change Image -> images
|
|
- editor/filemanager/browser/default/connectors/php/config.php
|
|
- Commented hardcoded Userdir path
|
|
- Enable the browser
|
|
- editor/filemanager/upload/php/config.php
|
|
- Commented hardcoded Userdir path (is disabled by default)
|
|
- editor/filemanager/browser/default/connectors/php/io.php
|
|
- Remove the append of directory per type, example, for images the final url is base+serverpath+images (or type)
|
|
|