BugFix: PHProxy 0.4 Include URL Form

Discussion in 'PHP' started by IntelliGuy, Dec 12, 2006.

  1. #1
    PHProxy 0.4 fails to include URL Form in proxied pages if the BODY tag of the web page has no attributes defined. It works for somthing like '<body background="bg.gif">' but not for '<body>' (here is another bug, it does not even proxify the background image of the BODY tag).

    Here is how to fix it.

    1. In 'function return_response($send_headers = true)', find this line:
    $this->modify_urls();
    Code (markup):
    2. Just after this line, add the following code:

    if ($this->flags['include_form'])
    {
        ob_start();
        include_once 'url_form.inc';
        $extra_html = "\n" . ob_get_contents();
        ob_end_clean();
        $this->response_body = preg_replace('#(<\s*body\b[^>]*>)#is',  '\\1' . $extra_html, $this->response_body);
    }
    Code (markup):
    3. Now, form 'function modify_urls()', remove these lines:
    case 'body':
        if ($this->flags['include_form'])
        {
            $rebuild = true;
            ob_start();
                include_once 'url_form.inc';
                $extra_html = "\n" . ob_get_contents();
            ob_end_clean();
        }
    Code (markup):
    And you are done!

    Btw, the 3rd step also fixes the other bug that prevents PHProxy from proxifying background image of the BODY tag.

    P.S: Dont forget to add some green if you find it useful. ;)
     
    IntelliGuy, Dec 12, 2006 IP
    saadahmed007, rochow and Evolv5 like this.
  2. saadahmed007

    saadahmed007 Admínistratör

    Messages:
    5,272
    Likes Received:
    869
    Best Answers:
    0
    Trophy Points:
    380
    #2
    Hi Intelliguy;),
    Just fixed this bug on one of my site :).Thanks alot for bugfix.Reps added :)
    Saad
     
    saadahmed007, Dec 12, 2006 IP
  3. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #3
    Been looking for this for ages

    Rep given! I bet you will get alot because of this :)

    EDIT: Can someone send me the file with this already changed, I'm having trouble getting it to work due to my limited PHP knowledge :p
     
    rochow, Dec 12, 2006 IP
  4. Evolv5

    Evolv5 Well-Known Member

    Messages:
    777
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #4
    I did what was said, but I still cant see the url form on youtube.com :/

    Maybe it's because I just deleted my php.ini file. And now my webserver crashed.

    **EDIT**
    It fixed itself :) It works now! Thanks a lot!
     
    Evolv5, Dec 13, 2006 IP