Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
spell_checker.php
1 <?php
24 require_once dirname(__FILE__).'/../../../../core/include/init.inc';
25 include_once dirname(__FILE__).'/../../../../data/private/conf/tools.inc';
26 
27 if (empty($GLOBALS['SQ_SYSTEM']->user) || !($GLOBALS['SQ_SYSTEM']->user->canAccessBackend() || $GLOBALS['SQ_SYSTEM']->user->type() == 'simple_edit_user')){
28  exit;
29 }
30 
31 header('Content-type: text/html; charset: utf-8');
32 
33 ?>
34 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
35 <html>
36  <head>
37  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
38  <style type="text/css">
39  .HA-spellcheck-error {
40  border-bottom: 2px dotted #FF0000;
41  cursor: pointer;
42  }
43 
44  .HA-spellcheck-same {
45  color: #000000;
46  font-weight: bold;
47  }
48 
49  .HA-spellcheck-hover {
50  color: #000000;
51  }
52 
53  .HA-spellcheck-fixed {
54  border-bottom: 1px dotted #0b8;
55  }
56 
57  .HA-spellcheck-current {
58  color: #000000;
59  background-color: #EBEBEB;
60  font-weight: bold;
61  }
62 
63  .HA-spellcheck-suggestions {
64  display: none;
65  }
66 
67  #HA-spellcheck-dictionaries {
68  display: none;
69  }
70 
71  a:link, a:visited {
72  color: #55e;
73  }
74 
75  body {
76  font-family: tahoma,verdana,sans-serif;
77  font-size: 14px;
78  color: #666666;
79  }
80  </style>
81  </head>
82  <body onload="window.parent.finishedSpellChecking();" bgcolor="#FFFFFF">
83  <?php
84  $GLOBALS['spellerId'] = 0;
85  $GLOBALS['dict'] = SQ_TOOL_SPELL_CHECKER_LANG;
86 
87  // the user has asked to change the dictionary and re-check
88  // dictionary is now a global preference
89  /*
90  if (isset($_REQUEST['dictionary'])) {
91  if ($_REQUEST['dictionary'] != "") {
92  $GLOBALS['dict'] = $_REQUEST['dictionary'];
93  }
94  }
95  */
96 
97  /*
98  // leave out the dicrtionary support for the moment
99  if ($_REQUEST['init'] == 1) {
100  // don't put spaces between these as js is going to tokenize them up
101  echo "<div id='HA-spellcheck-dictionaries'>en,en_GB,en_US,en_CA,sv_SE,de_DE,pt_PT</div>";
102  }
103  */
104 
105  if (get_magic_quotes_gpc()) {
106  foreach ($_REQUEST as $k => $v) {
107  $_REQUEST["$k"] = stripslashes($v);
108  }
109  }
110 
111  require_once DIRNAME(__FILE__).'/spell_parser.inc';
112  require_once 'XML/XML_HTMLSax.php';
113 
114  $handler =& new Spell_Parser();
115  $handler->setLanguage($GLOBALS['dict']);
116 
117  $parser =& new XML_HTMLSax();
118  $parser->set_object($handler);
119  $parser->set_element_handler('openHandler', 'closeHandler');
120  $parser->set_data_handler('dataHandler');
121 
122  $string_to_parse = stripslashes($_POST['content']);
123 
124  $parser->parse($string_to_parse);
125 
126  ?>
127  <body>
128 </html>