Merge branch 'w37_MDL-29081_m22_googlespellproxy' of git://github.com/skodak/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2011-09-19 18:09:47 +02:00
commit 3d5bb9115d
2 changed files with 41 additions and 14 deletions

View File

@ -79,6 +79,26 @@ class GoogleSpell extends SpellChecker {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
if (!empty($this->_config['GoogleSpell.proxyhost'])) {
if (!empty($this->_config['GoogleSpell.proxytype']) and ($this->_config['GoogleSpell.proxytype'] === 'SOCKS5')) {
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
} else {
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTML);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, FALSE);
}
if (empty($this->_config['GoogleSpell.proxyport'])) {
curl_setopt($ch, CURLOPT_PROXY, $this->_config['GoogleSpell.proxyhost']);
} else {
curl_setopt($ch, CURLOPT_PROXY, $this->_config['GoogleSpell.proxyhost'].':'.$this->_config['GoogleSpell.proxyport']);
}
if (!empty($this->_config['GoogleSpell.proxyuser']) and !empty($this->_config['GoogleSpell.proxypassword'])) {
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->_config['GoogleSpell.proxyuser'].':'.$this->_config['GoogleSpell.proxypassword']);
if (defined('CURLOPT_PROXYAUTH')) {
// any proxy authentication if PHP 5.1
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
}
}
}
$xml = curl_exec($ch);
curl_close($ch);
} else {

View File

@ -14,20 +14,27 @@ require_once(dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__F
//$config['general.engine'] = 'PSpellShell';
//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
if ($config['general.engine'] === 'PSpell' or $config['general.engine'] === 'PSpellShell') {
// PSpell settings
$config['PSpell.mode'] = PSPELL_FAST;
$config['PSpell.spelling'] = "";
$config['PSpell.jargon'] = "";
$config['PSpell.encoding'] = "";
// GoogleSpell settings
$config['GoogleSpell.proxyhost'] = isset($CFG->proxyhost) ? $CFG->proxyhost : '';
$config['GoogleSpell.proxyport'] = isset($CFG->proxyport) ? $CFG->proxyport : '';
$config['GoogleSpell.proxytype'] = isset($CFG->proxytype) ? $CFG->proxytype : 'HTML';
$config['GoogleSpell.proxyuser'] = isset($CFG->proxyuser) ? $CFG->proxyuser : '';
$config['GoogleSpell.proxypassword'] = isset($CFG->proxypassword) ? $CFG->proxypassword : '';
// PSpellShell settings
$config['PSpellShell.mode'] = PSPELL_FAST;
$config['PSpellShell.aspell'] = $CFG->aspellpath;
$config['PSpellShell.tmp'] = '/tmp';
if ($config['general.engine'] === 'PSpell' or $config['general.engine'] === 'PSpellShell') { // moodlehack
// PSpell settings
$config['PSpell.mode'] = PSPELL_FAST;
$config['PSpell.spelling'] = "";
$config['PSpell.jargon'] = "";
$config['PSpell.encoding'] = "";
// Windows PSpellShell settings
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
//$config['PSpellShell.tmp'] = 'c:/temp';
}
// PSpellShell settings
$config['PSpellShell.mode'] = PSPELL_FAST;
$config['PSpellShell.aspell'] = $CFG->aspellpath;
$config['PSpellShell.tmp'] = '/tmp';
// Windows PSpellShell settings
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
//$config['PSpellShell.tmp'] = 'c:/temp';
}
?>