Exemple #1
0
    case 'German':
        $spell_dictionary = 'de-DE.dic';
        break;
    default:
        $spell_dictionary = 'en-US.dic';
        break;
}
$sp = new Spellchecker(INI_DIR . '/dictionary/' . $spell_dictionary);
if ($sp->_error === '') {
    $xmlStr = isset($_POST['xml']) ? $_POST['xml'] : '<?xml version="1.0" encoding="utf-8"?><webmail><param name="action" value="spellcheck"/><param name="request" value="spell"/><text><![CDATA[]]></text></webmail>';
    $log->WriteLine("<<<[Spellchecker]<<<\r\n" . $xmlStr);
    $cxml = new XmlDocument();
    $cxml->ParseFromString($xmlStr);
    $response = new XmlDocument();
    $response->CreateElement('webmail');
    if ($cxml->GetParamValueByName('action') == 'spellcheck') {
        $req = $cxml->GetParamValueByName('request');
        switch ($req) {
            case 'spell':
                $text = $cxml->XmlRoot->GetChildValueByTagName('text');
                $sp->text = $text;
                $misspel = $sp->ParseText();
                $node = new XmlDomNode('spellcheck');
                foreach ($misspel as $misspelNode) {
                    $misp = new XmlDomNode('misp', '');
                    $misp->AppendAttribute('pos', $misspelNode[0]);
                    $misp->AppendAttribute('len', $misspelNode[1]);
                    $node->AppendChild($misp);
                    unset($misp);
                }
                $node->AppendAttribute('action', 'spellcheck');
Exemple #2
0
$_xml = isset($_POST['xml']) ? $_POST['xml'] : '';
$_xmlRequest = new XmlDocument();
$_xmlRequest->ParseFromString($_xml);
$_log =& CLog::CreateInstance();
if (!USE_FULLPARSE_XML_LOG) {
    $_log->WriteLine('<<<[client_xml]<<<' . "\r\n" . $_xml);
} else {
    if ($_log->Enabled) {
        $_log->WriteLine('<<<[client_xml]<<<' . "\r\n" . $_xmlRequest->ToString(true));
    }
}
$_settings =& Settings::CreateInstance();
if (!$_settings || !$_settings->isLoad) {
    _localPrintErrorAndExit('', $_xmlResponse, 3);
}
$_action = $_xmlRequest->GetParamValueByName('action');
$_request = $_xmlRequest->GetParamValueByName('request');
$BackgroundXmlParam = (int) $_xmlRequest->GetParamValueByName('background');
if (!isset($_SESSION[ACCOUNT_ID]) && $_action != 'login' && $_action != 'registration' && $_action != 'resetpassword') {
    $_xmlResponse->XmlRoot->AppendChild(new XmlDomNode('session_error'));
    _localPrintXML($_xmlResponse, $_startTime);
}
$_accountId = isset($_SESSION[ACCOUNT_ID]) ? $_SESSION[ACCOUNT_ID] : null;
if (!$_settings->IncludeLang()) {
    _localPrintErrorAndExit('', $_xmlResponse, 6);
}
$_dbStorage =& DbStorageCreator::CreateDatabaseStorage($_null);
if (!$_dbStorage || !$_dbStorage->Connect()) {
    _localPrintErrorAndExit(getGlobalError(), $_xmlResponse);
}
$_args = array('_dbStorage' => &$_dbStorage, '_settings' => &$_settings, '_xmlRequest' => &$_xmlRequest, '_xmlResponse' => &$_xmlResponse, '_accountId' => $_accountId);