/plugins/squirrelspell/sqspell_functions.php

Description

sqspell_functions.php ---------------------- All SquirrelSpell-wide functions are in this file.

Copyright (c) 1999-2014 The SquirrelMail Project Team Licensed under the GNU GPL. For full terms see the file COPYING.

Functions
sqspell_ckMOD (line 518)

This function checks for security attacks. A $MOD variable is

provided in the QUERY_STRING and includes one of the files from the modules directory ($MOD.mod). See if someone is trying to get out of the modules directory by providing dots, unicode strings, or slashes.

  • return: since it bails out with an access error if needed.
void, sqspell_ckMOD (string $rMOD)
  • string $rMOD: the name of the module requested to include.
sqspell_crypto (line 154)

This function does the encryption and decryption of the user dictionary. It is only available when PHP is compiled with mcrypt support (--with-mcrypt). See doc/CRYPTO for more information.

  • return: content, or "PANIC" if the process bails out.
encrypted/decrypted sqspell_crypto ($mode $mode, $ckey $ckey, $input $input)
  • $mode $mode: A string with either of the two recognized values: "encrypt" or "decrypt".
  • $ckey $ckey: The key to use for processing (the user's password in our case.
  • $input $input: Content to decrypt or encrypt, according to $mode.
sqspell_deleteWords (line 482)
void sqspell_deleteWords ()
sqspell_getLang (line 283)

This function returns only user-defined dictionary words that correspond to the requested language.

  • return: list of words corresponding to the language requested.
The sqspell_getLang ($words $words, $lang $lang)
  • $words $words: The contents of the user's ".words" file.
  • $lang $lang: Which language words to return, e.g. requesting "English" will return ONLY the words from user's English dictionary, disregarding any others.
sqspell_getSettings (line 233)

Right now it just returns an array with the dictionaries available to the user for spell-checking. It will probably do more in the future, as features are added.

  • return: a strings array with dictionaries available to this user, e.g. {"English", "Spanish"}, etc.
array sqspell_getSettings (string $words)
  • string $words: The contents of the user's ".words" file.
sqspell_getWords (line 311)

This function operates the user dictionary. If the format is

clear-text, then it just reads the file and returns it. However, if the file is encrypted (well, "garbled"), then it tries to decrypt it, checks whether the decryption was successful, troubleshoots if not, then returns the clear-text dictionary to the app.

  • return: contents of the user's ".words" file, decrypted if necessary.
the sqspell_getWords ()
sqspell_makeDummy (line 500)

Creates an empty user dictionary for the sake of saving prefs or whatever.

  • return: template to use when storing the user dictionary.
The sqspell_makeDummy ()
sqspell_makePage (line 28)

This function is the GUI wrapper for the options page. SquirrelSpell uses it for creating all Options pages.

void sqspell_makePage (string $title, string $scriptsrc, string $body)
  • string $title: The title of the page to display
  • string $scriptsrc: This is used to link a file.js into the <script src="file.js"></script> format. This allows to separate javascript from the rest of the plugin and place it into the js/ directory.
  • string $body: The body of the message to display.
sqspell_makeWindow (line 102)

Function similar to the one above. This one is a general wrapper for the Squirrelspell pop-up window. It's called form nearly everywhere, except the check_me module, since that one is highly customized.

void sqspell_makeWindow (string $onload, string $title, string $scriptsrc, string $body)
  • string $onload: Used to indicate and pass the name of a js function to call in a <body onload="function()" for automatic onload script execution.
  • string $title: Title of the page.
  • string $scriptsrc: If defined, link this javascript source page into the document using <script src="file.js"> format.
  • string $body: The content to include.
sqspell_upgradeWordsFile (line 207)

This function transparently upgrades the 0.2 dictionary format to the 0.3 format, since user-defined languages have been added in 0.3 and the new format keeps user dictionaries selection in the file.

This function will be retired soon, as it's been a while since anyone has been using SquirrelSpell-0.2.

  • return: of the 0.3-style user dictionary.
Contents sqspell_upgradeWordsFile ($words_string $words_string)
  • $words_string $words_string: Contents of the 0.2-style user dictionary.
sqspell_writeWords (line 438)

Writes user dictionary into the $username.words file, then changes mask to 0600. If encryption is needed -- does that, too.

void sqspell_writeWords ($words $words)
  • $words $words: The contents of the ".words" file to write.

Documentation generated on Sat, 01 Nov 2014 04:21:55 +0100 by phpDocumentor 1.4.3