WordPress.org

Forums

tinyMCE undefined when realpath disabled (6 posts)

  1. muchacholoco
    Member
    Posted 8 years ago #

    IMPORTANT: THIS IS FOR ANYBODY THAT HAS FUNCTION realpath DISABLED BY THE SERVER

    I've found a way to manage and override the usage of realpath function in order to see the tinyMCE toolbar.

    First step:
    Edit tiny_mce_gzip.php and just below

    @require_once('../../../wp-config.php'); // For get_bloginfo().

    add the following code:

    // beggining of myRealPath
    
      function myRealPath($path) {
    
        // check if path begins with "/" ie. is absolute
        // if it isnt concat with script path
        if (strpos($path,"/") !== 0) {
            $base=dirname($_SERVER['SCRIPT_FILENAME']);
            $path=$base."/".$path;
        }
    
        // canonicalize
        $path=explode('/', $path);
        $newpath=array();
        for ($i=0; $i<sizeof($path); $i++) {
            if ($path[$i]==='' || $path[$i]==='.') continue;
               if ($path[$i]==='..') {
                  array_pop($newpath);
                  continue;
            }
            array_push($newpath, $path[$i]);
        }
        $finalpath="/".implode('/', $newpath);
    
        // check then return valid path or filename
        if (file_exists($finalpath)) {
            return ($finalpath);
        }
        else return FALSE;
    }
    
      // end of myRealPath

    Second step:
    Edit and replace inside tiny_mce_gzip.php
    realpath
    into
    myRealPath

    This should get your tinyMCE toolbar working. Make sure that you have "Use the visual editor when writing" under your profile selected.

    If you have some doubts, send mail to: mail@muchacholoco.com.ar

  2. dissid3nt
    Member
    Posted 7 years ago #

    Thanks! This really helped me out!

  3. lgaulier
    Member
    Posted 7 years ago #

    Thanks a lot ! I was working on the problem and this is the only thing that did the trick.

    Respect :)

  4. otakugirl
    Member
    Posted 7 years ago #

    This was the only solution out of about 10 that worked! thank you SO much!!

  5. diismalley
    Member
    Posted 7 years ago #

    Thanks, I was also having this problem and it fixed it straight away. Only problem is I really find the inbuilt editor very restrictive and want to use the plugin - Advanced Tiny MCE Editor and as soon as I turn the plugin on the whole Editor disappears again. Any thoughts on this please?
    You all just blow me away by how much you know!

    many thanks

  6. jorgeni
    Member
    Posted 7 years ago #

    Thanks, at last a solution that worked!

Topic Closed

This topic has been closed to new replies.

About this Topic