Firefox PHP

In-body attachment links/images (for Phorum 5.1 or later)

Posted by Maurice Makaay 
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 01:35PM
Hi Maurice thanks for your reply,

I just added the code you gave me in the common.php of phorum in the right spot but I'm not getting printed anything on the screen

I just copy and pasted your code, may be a spelling error? Or does it tell you anyting if nothing is shown after adding this?

You can check the post where I test this at:

[www.hummer-zone.com]

I think you need to login to read it, you can do so by logging in on the left side with
user test
pass test

Thanks

Tino
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 01:50PM
Hmm.. that string not showing is because the embedding code "eats" it I think. You can also do a blunt die() call there, which will stop your pages from displaying, so don't keep it in there ;-)
die($GLOBALS["PHORUM_CUSTOM_QUERY_STRING"]);

For some more user friendliness, you could add some code to make it conditional for your IP address:
if ($_SERVER['REMOTE_ADDR'] == '1.2.3.4') { # <--  your IP here
    die($GLOBALS["PHORUM_CUSTOM_QUERY_STRING"]);
}


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 01:55PM
thanks

it spits out the following now
23,679,693

when accessing that page:
[www.hummer-zone.com]

and nothing when just going to the forumlist at [www.hummer-zone.com]
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 03:58PM
Oh right, you should open the image scale URL, not the read URL. So open the one with the encoded URL and in_body_scaled_image in it directly in your browser. That's the interesting one. However ...

I tried opening the URL that failed for you directly in my browser and the webserver reported a 404 error, so file not found. It seems that the URL with the properly encoded filename makes your server think it's handling a non-existant file. Since the server is reporting a 404, I guess that it's not even getting to the point where the Phorum connector can work with the custom query string and return a scaled image.

Are you using some special rewriting rules or so to make this work? I'm asking, since I do not see a real PHP script being called in the URL. If you are using rewriting, then the rewriting needs some attention to allow use of URL encoded characters as well.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 04:36PM
Hi Maurice good observation,

yes rewriting is used on that domain. Here are the rewriting rules that are used. I want to be careful changing them since my drupal set up seems to make some good use of it and it was not too easy to set them up.

These are all the rewriting rules in the htaccess file. Hope you can find something here. I'm no expert in that stuff.

# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to [www.example.com]...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ [www.example.com] [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to [example.com]...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ [example.com] [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  RewriteBase /
  
  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
# $Id: .htaccess,v 1.81.2.2 2007/05/21 01:34:59 drumm Exp $

Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 04:39PM
btw it's PHP Version 4.4.1 on a Apache/1.3 (Unix)
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 04:49PM
ok just turned clean urls in drupal off and it seemed to work (though in FF only the external images were displayd and the ones that have been uploaded did not display - in IE both worked perfektly)

However I defintely want to keep the clean URLs any way of working around this?
May be adjust the rewrite rules?

Tino
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 05:49PM
Sorry, I'm not Drupal literate and this seems a specific Drupal thing. Maybe the Drupal people can help you to make those clean URs work?


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 02, 2007 05:58PM
hmm yeah thanks I'll have to look into it
Re: In-body attachment links/images (for Phorum 5.1 or later)
November 03, 2007 02:09PM
HI Maurice

it's me again :P

I just found out that I can still use unclean URLs in Drupal even if clean urls are turned on

that means

[www.hummer-zone.com]
or the uncleaned version
[www.hummer-zone.com]

both work at the same time,
which means if I was able to change the URL in the module to this particular fixed URL (may be hard code somehow) it would work

It might not be the best solution but a work around for now.


see for yourself

[www.hummer-zone.com]

works while

[www.hummer-zone.com]

does not

the htaccess is however turned on for the rest of the site.
The drupal URL rewriting seems to be set up in a way that the not clean URLs still work

so your image resize script is accessible both ways, I'd just have to adjsut the URL that is used to call your script

Let me know what you think

Tino

Discover the Divine Truth | [www.discoverthedivinetruth.com]



Edited 1 time(s). Last edit at 11/03/2007 02:11PM by DonTino.
Sorry, only registered users may post in this forum.

Click here to login