Help - Search - Members - Calendar
Full Version: PHP in boardwrappers
Invision Power Services > Community Forums > Community General Chat
unknown12
IS there a guide I can follow to allow PHP in my board wrappers?

thanks.
Coastie
sure would be nice if that was a feature. From my reading, it was not implimented because then skinners could induce unsafe php in the skins they provide.
Antony
I think we should have a "Parse PHP in board wrappers" setting for each skin, that can't be enabled via skin imports...
unknown12
Is there a hack I can use to get it?
BradleeSmith
What do you need the PHP for? Good luck getting it, there is no documentation or mods that I could find.
Antony
There is a hack at Invisionize, although it doesn't work terribly well.
Matthew_UK
It doesn't work in the wrappers and as said the hack available isn't reliable (it produces server errors, etc).

It would be useful to be able to use PHP Includes though for various reasons in the wrapper. original.gif
Tommeh.
try this to enable php in the board wrappers:
(this is for 2.1 beta 2, but it should still work shifty.gif )

open sources/classes/class_display.php
find this line:
CODE
         $this->ipsclass->skin['_wrapper'] = str_replace( "<% CSS %>"            , $css                                , $this->ipsclass->skin['_wrapper']);

add before it:
CODE
      $marker = sha1(microtime());
      $wrappertags = array('/<% .+? %>/','/<!--IBF\..+?-->/i');
         $this->ipsclass->skin['_wrapper'] = preg_replace($wrappertags, "<!--noexec-$marker-->\\0<!--/noexec-$marker-->",$this->ipsclass->skin['_wrapper']);


find this line
CODE
  print $this->ipsclass->skin['_wrapper'];

replace it with:
CODE
      $parts = explode("<!--noexec-$marker-->",$this->ipsclass->skin['_wrapper']);
      foreach ($parts as $part1)
      {
        $part2 = explode("<!--/noexec-$marker-->",$part1);
        if (count($part2)==0) // no noexec tag so run as php
        {
          eval('?>'.$part1);
        } else // noexec tag, format: {unsafe html bit}<!--/noexec-$marker-->{safe wrapper}
        {
          print $part2[0];
          eval('?>'.$part2[1]);
        }
      }


there are certainly more eligant ways of achieving this, this is just one I can think of with the shortest amount of file edits happy.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.