vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Mimetex (https://vborg.vbsupport.ru/showthread.php?t=68116)

the_sisko 08-07-2004 10:00 PM

Mimetex
 
As I promised in this thread some time ago, I will post a short install note on how to get mimetex to work on vB.

1.
You need to download the mimeTex source files to compile and install mimeTeX. I don't know if it is allowed to attached the compied mimetex.cgi file, nor do I know if there is something server specific in my file. So you have to do this on your own. Compile and installation instruction can be found in the mimetex source files.
http://moodle.org/download/mimetex/source/mimetex.html
EDIT (2005-06-14):Added the mimetex.cgi file as attachment

2.
Upload the mimetex.cgi file to a folder on your server where it could be used. As we don't wanted our users or anybody else to access this file, we put it outside the webserver root.

3. Create a folder on your webserver where the mimeTex images should be stored.

4.
Open the atteched functions_mimetex.php and alter the three variables at the beginning to your needs. Upload the attached functions_mimetex.php file to your /includes/ folder.

5.
Open /includes/functions_bbcodeparse.php
Find:
PHP Code:

    // end smilies 

below add:
PHP Code:

  // Latex Hack by CDK
    
require_once('functions_mimetex.php');   
    
$bbcode mimetex($bbcode); 

upload altered file.

6. If everything went right you should now can use [tex]\frac{x^3 + 2 x^2 - 6 x + 7}{x^2+1}[/tex] which results in http://www.chemieonline.de/images/fo...97a0d49e15.gif


I've put up some samples in the zip file. More samples by one of our Moderators can be found here: http://www.studenten-city.de/forum/s...91&postcount=1


It was a hack made for our forum, I have no further interest in developing this into a real stabel hack. Its working for us. I posted this, just to give other users who needed this a start into the right direction.

the_sisko 08-08-2004 01:57 PM

Saved for future need.

Erwin 08-09-2004 12:29 PM

Very cool! :)

Gary King 08-10-2004 05:40 PM

Interesting stuff, I will install this soon enough.

Highlander 08-11-2004 04:24 AM

sry my english is not the best and i didnt understand what mimetext does?!

can you explain it in simple words for meplease?

the_sisko 08-11-2004 06:33 AM

Quote:

Originally Posted by Highlander
sry my english is not the best and i didnt understand what mimetext does?!

can you explain it in simple words for meplease?

[german]
Wie w?re es auf deutsch?
Mimetex erlaubt es einem Latex/Tex Formeln im Forum einzubinden. So kann man z.B. mathematische, chemische, physikalische Formeln sehr sch?n darstellen. Schau Dir einfach mal die Beispiele im ZIP an oder auf der Webseite die ich gelinkt habe.
[/german]

Streicher 08-16-2004 04:04 PM

After The_Sisko wrote this new cool hack for our site, i make an addition for users, who don't know much about Mimetex. They can now insert mimtex code with one mouse click, just like the smilies.

Find in vbulltin_editor.js:
PHP Code:

window.open("misc.php?" SESSIONURL "do=getsmilies&wysiwyg=" wysiwyg "&forumid=" forumid"smilies""statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=" x_width ",height=" y_width);


Right below add:
PHP Code:

function open_mimetex_window(x_widthy_widthwysiwygforumid)
{
    if (
typeof(forumid) == "undefined")
    {
        
forumid 0;
    }
    
window.open("tex.php?" SESSIONURL "do=getsmilies&wysiwyg=" wysiwyg "&forumid=" forumid"smilies""statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=" x_width ",height=" y_width);


Save and Upload.

Make a new file called "tex.php" (based upon: https://vborg.vbsupport.ru/showthread.php?t=62164):
PHP Code:

<?php 

// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''tex'); // change this depending on your filename 

// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array( 

); 

// get special data templates from the datastore 
$specialtemplates = array( 
     
); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
    
'mimetex'
); 

// pre-cache templates used by specific actions 
$actiontemplates = array( 

); 

// ######################### REQUIRE BACK-END ############################ 
require_once('./global.php'); 

// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 

$navbits = array(); 
$navbits[$parent] = 'Mimetex'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 
eval(
'print_output("' fetch_template('mimetex') . '");'); 

?>

Save and Upload to your forum folder.

Go into your AdminCp and make a new template called "mimetex" (Some parts are german, but you can easily make your own text). Insert the content of the attached file and check the path to your mimetex.cgi

Then open template "editor_toolbar_standard" and find
PHP Code:

<!-- end control bar --></div><!-- / end control bar --> 

Above it add (just an example, your can put it where you want in this template):
PHP Code:

<!-- fourth control row -->
    <
div class="controlholder">
        <
a href="#" onclick="open_mimetex_window(700, 400, $wysiwyg, '$forumid'); return false" title="Mimetex">Mimetex</a>
    </
div

Have fun!

TnT 08-24-2004 08:00 PM

If you run Windows as OS, replace this line:

PHP Code:

$command "$mimetex_path -e ".$full_path_filename." ".escapeshellarg($mimetex_formula); 

with this line:

PHP Code:

$command "$mimetex_path -e ".$full_path_filename." \" ".$mimetex_formula."\""

Thomas

kur1j 08-27-2004 07:58 PM

Maybe its just me but it seems very unclear in step 3. Create a folder on your webserver where the mimeTex images should be stored.

What pictures?

Streicher 08-27-2004 09:08 PM

Quote:

Originally Posted by kur1j
Maybe its just me but it seems very unclear in step 3. Create a folder on your webserver where the mimeTex images should be stored.

What pictures?

With the Mimetex Code in the posts the mimetex.cgi creates images on thy fly. The folder is for these images.

Holidazed 09-16-2004 12:29 PM

Can somebody please explain to me what this hack does?

the_sisko 09-16-2004 12:35 PM

Quote:

Originally Posted by bitg
Can somebody please explain to me what this hack does?

Just take a look at the samples in the zip file.
You can post latex codes on your forums which will generate a picture with the formular.

php4dev 06-06-2005 11:11 PM

please attach the compiled mimetex.cgi as a zip file....

and if you want give us more infromations about the installation ...

I am not a profissional like you :tired:

thanks and best regards

the_sisko 06-07-2005 07:21 AM

As I said in my first post, I don't know if I can do this nor do I know if there is anything server specific in my CGI file.
Here a quote from the install README:
Quote:

QUICK START
------------------------------------------------------------------------
To compile and install mimeTeX
* unzip mimetex.zip in any convenient working directory
* to produce an executable that emits anti-aliased
gif images (recommended)
cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi
-or- for gif images without anti-aliasing
cc -DGIF mimetex.c gifsave.c -lm -o mimetex.cgi
-or- to produce an executable that emits mime xbitmaps
cc -DXBITMAP mimetex.c -lm -o mimetex.cgi
(For Windows, see "Compile Notes" in Section III below.)
* mv mimetex.cgi to your server's cgi-bin/ directory
* mv mimetex.html to your server's htdocs/ directory
* if the relative path from htdocs to cgi-bin isn't
../cgi-bin then edit mimetex.html and change the
few dozen occurrences as necessary.
Then, to quickly learn more about mimeTeX
* point your browser to www.yourdomain.com/mimetex.html
Any problems with the above?
* read the more detailed instructions below,
or see http://www.forkosh.com/mimetex.html

php4dev 06-07-2005 09:12 AM

Quote:

Originally Posted by the_sisko
* to produce an executable that emits anti-aliased
gif images (recommended)
cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi
-or- for gif images without anti-aliasing
cc -DGIF mimetex.c gifsave.c -lm -o mimetex.cgi
-or- to produce an executable that emits mime xbitmaps
cc -DXBITMAP mimetex.c -lm -o mimetex.cgi
(For Windows, see "Compile Notes" in Section III below.)

This is very complex way .... :cry: :cry: :cry: :cry: :cry:


Can you give me another way to compile the cgi file ? please ?


Thanks & best regards

php4dev 06-10-2005 11:03 AM

:) :)

the_sisko 06-14-2005 05:28 PM

Added the compiled mimetex.cgi file to the first post.

php4dev 06-14-2005 07:29 PM

thank you veeeeery much my friend



:)

edst 08-31-2005 02:30 PM

I've just installed this and have followed the directions thoroughly. Note that there's a missing close quote and ; from line 11 of the functions_mimetex.php in the zip file.

When I try to put an equation in a thread, I now get an error message:

Warning: system() has been disabled for security reasons in /includes/functions_mimetex.php on line 49

How do I address this error message? I see the system() call is what's actually referencing the cgi file, so it's clearly critical to this functionality.

edst 08-31-2005 04:04 PM

Okay, I've found a workaround. So if you cannot use system calls on your system, replace all the lines inside the $do_latex loop as follows:
Code:

    if($do_latex) {
            $mimetex_formula = $tex_matches[1][$i];
          $text = substr_replace($text, "<img src='".$cgi_path."?".$mimetex_formula."' alt='".htmlentities($mimetex_formula, ENT_QUOTES)."' align=absmiddle>",$pos,strlen($tex_matches[0][$i]));
    }

Where $cgi_path is defined at the top as:
Code:

        $cgi_path = "http://yourdomain/cgi-bin/mimetex.cgi";
There are no images stored with this method, so some could be trimmed down from the initial php code too.

edit: cleaned up the img tag a bit.

the_sisko 09-01-2005 06:30 AM

I see you found a solution fpr your self, just wanted to answer to your warining message:

system() has been disabled for security reasons

You or your host disabled the system function or even all execute function of php. This is done on a shared server to protect the server and clients in a better way.

Your workaround is nice. Images won't be stored and rendered everytime a user visits a post. This could be a problem on big boards...

edst 09-01-2005 11:37 AM

You're right -- the re-rendering could be an issue for larger boards. In this case, you could build a new version of mimetex.cgi that uses the -DCACHEPATH=\"path/\" argument and still cache the images locally. This probably makes sense to do whenever the workaround is needed.

On that note, if you're building your own mimetex.cgi anyway, I'd recommend using the -DREFERER=\"domain\" argument too. This will add some level of security so that others cannot make use of the engine if it's located in a public area of your server.


All times are GMT. The time now is 04:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03424 seconds
  • Memory Usage 1,817KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (9)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete