Voici un endroit pour faire vos essais


Une action utilisant un API de Google est ici: ActionTex


Formules TeX compilées directement sur le serveur



On doit mettre un \ devant une formule que l'on balise de (FormuleTEX\). Pour voir les exemples ci-dessous, éditer la page.

Principe : WikiniMST convertit les formules TEX en image png. Vous pouvez copier les images et les insérer dans un autre logiciel (SPIP, OpenOffice.org, etc.).

Gestion des tailles des images


Utilisant le moteur TeX de mediawiki, on peut donc gérer la taille des images créées comme ci-dessous.

Très petite: \( \scriptscriptstyle\int_{0}^{\infty} {\frac{e^2}{47} dt} \) donne
", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


Petite: \( \scriptstyle\int_{0}^{\infty} {\frac{e^3}{47} dt} \) donne
", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


Moyenne:\( \textstyle\int_{0}^{\infty} {\frac{e^4}{47} dt} \) donne
", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


Grande: \( \int_{0}^{\infty} {\frac{e^5}{47} dt} \) donne
", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>




", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>



", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

Soit ABC un triangle rectangle en C.
Si a = 6 mm et b = 8 mm, que vaut la mesure de c ?
", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>



", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


Une tautologie :
", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>



", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>

Comment paut on faire pour éditer cette page ?
Quand je double-clique dessus, j'ai un message d'interdiction
Merci
-- AToulouse-254-1-103-187.w86-207.abo.wanadoo.fr (2006-10-07 02:05:52)

Autant pour moi, il suffisait de cliquer sur le lien TXT.
Par contre, je n'arrive pas à écrire correctement le signe intégral (c'est juste pour des essais), les bornes ne s'inscrivent pas au bon endoroit mais au dessus et en dessous de l'intégrale


", "<" ), array( "&", """, ">", "<" ), $in ); } } if (!function_exists("linkToMathImage")) { function linkToMathImage ($wgMathPath, $tex, $outputhash ) { global $wiki; return "config["ghostscript_png_ext"] ."\" alt=\"".wfEscapeHTML($tex)."\" />"; } } if (!function_exists("renderMath")) { function renderMath( $tex ) { global $wiki; $mf = "math_failure"; $munk = "math_unknown_error"; $math_dir_url = $wiki->config["math_dir_url"]; $math_dir_sys = $wiki->config["math_dir_sys"]; $math_tmp_dir = $wiki->config["math_tmp_dir"]; $math_inputenc = $wiki->config["math_inputenc"]; $math_render_type = $wiki->config["math_render_type"]; /* 0 : "Toujours produire une image PNG", 1 : "HTML si tres simple, autrement PNG", 2 : "HTML si possible, autrement PNG", 3 : "Laisser le code TeX original", 4 : "Pour les navigateurs modernes" (mathml) */ if ($math_render_type == 3) return ('$ '.wfEscapeHTML($tex).' $'); $md5 = md5($tex); $md5_sql = mysql_escape_string(pack("H32", $md5)); if ($math_render_type == 0) $sql = "SELECT math_outputhash FROM ".$wiki->config["table_prefix"] ."math WHERE math_inputhash = '".$md5_sql."'"; else $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM ".$wiki->config["table_prefix"]."math WHERE math_inputhash = '".$md5_sql."'"; $res = $wiki->Query($sql); if( $rpage = mysql_fetch_object( $res ) ) { $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " ); $outputhash = $outputhash ['md5']; if( file_exists( "$math_dir_sys/$outputhash" .$wiki->config["ghostscript_png_ext"] ) ) { if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($rpage->math_html_conservativeness != 2)) || (($math_render_type == 4) && ($rpage->math_html_conservativeness == 0))) return linkToMathImage ( $wiki->config["math_dir_url"], $tex, $outputhash ); else { return $rpage->math_html; } } } $cmd = $wiki->config["math_texvc_path"]." " .escapeshellarg($math_tmp_dir)." " .escapeshellarg($math_dir_sys)." " .escapeshellarg($tex)." ".escapeshellarg($math_inputenc); echo $cmd; $contents = `$cmd`; if (strlen($contents) == 0) return "".$mf." (".$munk." 1): ".wfEscapeHTML($tex).""; $retval = substr ($contents, 0, 1); if (($retval == "C") || ($retval == "M") || ($retval == "L")) { if ($retval == "C") $conservativeness = 2; else if ($retval == "M") $conservativeness = 1; else $conservativeness = 0; $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); $outhtml = substr($outdata, 0, $i); $mathml = substr($outdata, $i+1); $sql_html = "'".mysql_escape_string($outhtml)."'"; $sql_mathml = "'".mysql_escape_string($mathml)."'"; } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) { $outhtml = substr ($contents, 33); if ($retval == "c") $conservativeness = 2; else if ($retval == "m") $conservativeness = 1; else $conservativeness = 0; $sql_html = "'".mysql_escape_string($outhtml)."'"; $mathml = ''; $sql_mathml = 'NULL'; } else if ($retval == "X") { $outhtml = ''; $mathml = substr ($contents, 33); $sql_html = 'NULL'; $sql_mathml = "'".mysql_escape_string($mathml)."'"; $conservativeness = 0; } else if ($retval == "+") { $outhtml = ''; $mathml = ''; $sql_html = 'NULL'; $sql_mathml = 'NULL'; $conservativeness = 0; } else { if ($retval == "E") $errmsg = wfMsg( "math_lexing_error" ); else if ($retval == "S") $errmsg = wfMsg( "math_syntax_error" ); else if ($retval == "F") $errmsg = wfMsg( "math_unknown_function" ); else $errmsg = $munk." ".$retval; return "

".$mf." (".$errmsg.substr($contents, 1)."): " .wfEscapeHTML($tex)."

"; } $outmd5 = substr ($contents, 1, 32); if (!preg_match("/^[a-f0-9]{32}$/", $outmd5)) return "".$mf." (".$munk." 3): ".wfEscapeHTML($tex).""; $outmd5_sql = mysql_escape_string(pack("H32", $outmd5)); $sql = "REPLACE INTO ".$wiki->config["table_prefix"]."math VALUES ('" .$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html .", ".$sql_mathml.")"; $res = $wiki->Query($sql); # we don't really care if it fails if (($math_render_type == 0) || ($rpage->math_html == '') || (($math_render_type == 1) && ($conservativeness != 2)) || (($math_render_type == 4) && ($conservativeness == 0))) return linkToMathImage($wiki->config["math_dir_url"], $tex, $outmd5); else return $outhtml; } } echo renderMath($text); ?>


Cela fonctionne sur votre serveur, donc cela vient de ma config (Mandriva 2006 pour le serveur), ou alors il faut modifier quelque chose dans le fichier wakkaconfig !

Effectivement j'ai modifié la ligne :
"math_render_type" => "0", et maintenant, c'est OK
-- AToulouse-254-1-103-187.w86-207.abo.wanadoo.fr (2006-10-07 02:33:36)

Les droits en écriture ont été donnés à tous. Excusez-moi :o(
-- PierreLachance (2006-10-07 08:15:52)

Bonjour,
je ne poste surement pas au bon endroit mais tant pis.
J'aimerai savoir s'il est possible d'avoir la fonction d'edition de formule latex chez free.
A priori, d'après ce que j'ai lu -compris?- ce n'est possible que si wikini est hébergé chez soi sur une machine dotée de Linux.
Merci, et encore bravo!
-- lns-bzn-20-82-250-31-148.adsl.proxad.net (2006-10-13 17:01:38)

Bonjour, le module que nous utilisons demande une compilation sur le serveur, donc je ne crois pas que ce soit possible sur free :o(
-- PierreLachance (2006-10-15 08:45:50)

C'est bien dommage... Merci pour la reponse, et bonne continuation!
-- lns-bzn-57-82-249-6-60.adsl.proxad.net (2006-10-23 15:46:22)

 
IMP :: RSS :: HTML :: TXT :: Clone :: Historique :: Propriétaire : PierreLachance