Loading...
 
Skip to main content

History: PluginFormula

Preview of version: 19

Major Security Issue


Janko Heilgeist pointed out a major security problem with this plugin. Unfortunately, it is not easy to fix. See the source code for details. As an interim measure, I have disabled the plugin. If you understand the issues involved and still want to use the plugin, you can enable it by editing your copy of the source.

This plugin renders formulas calling ))LaTeX, uses its syntax, and if it leave some exploitable hole, the plugin will be unsafe. In the other hand, if aLaTeX(( implementation have those "holes" closed it could be used and make safer the plugin.

Also could exist more programs/libraries that convert formulas to images to be used by the script with few changes.

But the main alternative today is instead of generating graphic with the formula is to generate MathML, a markup language for math symbols, that can be viewed with Netscape7+/Mozilla or with Internet Explorer with the ))MathPlayer(( plugin. There are some php libraries that can be used for this, i.e. ASCIIMath (a PHP library to render formulas using MathML but is a php port of a gpl code, so if it is used the plugin should not be included with normal Tiki distribution) or other alternatives.


This plugin includes a mathematical formula in a wiki page.

This plugin works in Unix-style servers only. There is no Windows version of this plugin. If someone wants to contribute a port to mods.tikiwiki.org, that would be welcome. See the comments below for what might need to be done.

Usage

{FORMULA()}formula{FORMULA}

"formula" is a formula written in ))LaTeX(( syntax. Some examples can be seen in this Wikipedia page.

Requirements


This plugin depends on external programs and will not work in php safe mode. At present only *nix servers can use it. Your path must include latex, dvips, the convert programs. Also the plugin comes from GPL'd code, and that conflicts with TikiWiki LGPL license.

Consequently, the plugin is not installed in Tiki by default, but can be found in the download wiki plugins section of http://mods.tikiwiki.org.

Examples


{FORMULA()}e=mc^2{FORMULA} (render in text the formula)

{FORMULA()}\sqrt{2}\approx 1.4{FORMULA} (includes a .png showing that the square root of 2 is approx. 1.4)

Setup and Install Recipe


This recipe give the steps needed to set up and run the formula pluggin assuming you have root access on your server and tiki otherwise installed and running.

Check for the latex, dvips and convert commands with:
# which latex
# which dvips
# which convert

If you don't have one or more of them, you must install them. On ))RedHat((, version8, these commands come from the tetex-dvips, tetex-fonts, tetex-latex and tetex packages. If your system does not have X installed, which can be the case for servers, you may also need to install the following rpms:
dialog
psutils
netpbm-progs
netpbm
))ImageMagik((
ghostscript
ghostscript-fonts
VFlib2
urw-fonts
Omni
cups-libs
gimp-print
XFree86-truetype-fonts
chkfontpath
XFree86-font-utils
XFree86-xfs

FIXME: This directoins are not correct if you get the plugin from mods.tikiwiki.org. After the necessary support software is installed, install the plugin by coping the files into the necessary locations:

# cd <tiki-root-dir>/lib
# cp wiki-plugins-dist/wikiplugin_formula.php wiki-plugins/
# cp wiki-plugins-dist/tex2png .

Make sure tex2png has executable permission.

If you run into trouble you can debug it by running tex2png from the bash shell and looking at the output.

The server for Tikiwiki.org does not have the plugin insalled.

Development needed


The security problem, mentioned above and detailed in the source code is a big stumbling block. We need someone to figure out how to make this work without leaving a big open door for anyone to run any script on your server. Maybe we could start by looking at the way media wiki (the software used by wikipedia) handles the problem in their <math> syntax.

Comments regarding development of a Windows version of the Formula Plugin


probably renaming tex2png to tex2png.bat (well, and doing some adaptations like removing lines starting with #) and installing the windows port of latex, dvips and imagemagick/convert will be enough for it to run under windows, but can't assure it will work without trying.

History

Information Version
drsassafras Mass search and replace 32
View
drsassafras Mass search and replace 31
View
drsassafras Mass search and replace 30
View
Marc Laporte 29
View
Marc Laporte 28
View
Marc Laporte 27
View
Marc Laporte 26
View
Marc Laporte new URL 25
View
Xavier de Pedro 24
View
Xavier de Pedro 23
View
alexice 22
View
bprager 21
View
Danny Staple 20
View
george.geller 19
View
george.geller 18
View
Gustavo Muslera 17
View
george.geller 16
View
george.geller 15
View
george.geller 14
View
george.geller 13
View
Gustavo Muslera 12
View
george.geller 11
View
george.geller 9
View
george.geller 8
View
george.geller 7
View