dates1967 / simpleinvoices

Automatically exported from code.google.com/p/simpleinvoices
GNU General Public License v3.0
0 stars 0 forks source link

Authentication issue causes the character '1' to be prepended to URLs #216

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set authentication.http = true
2. View an invoice
3. Select Print Preview

What is the expected output? What do you see instead?

While it is expected that you should see a preview of what should be printed, 
instead what is returned is a broken web page, because calls to getURL returns 
the URL with a '1' prepended to it. So the style sheet is broken because 
instead of:

<link rel="stylesheet" type="text/css" 
href="http://mbp/simpleinvoices/templates/invoices/default/style.css" 
media="all">

I see this:

<link rel="stylesheet" type="text/css" 
href="http://1mbp/simpleinvoices/templates/invoices/default/style.css" 
media="all">

Same happens if I use IP address instead of host names.

The problem seems to be in the getURL() function of include/sql_queries.php:

$_SERVER['FULL_URL'] .= 
$config->authentication->http.$_SERVER['HTTP_HOST'].$dir;

I recently set "authentication.http = true" in config/config.ini in order to 
set up .htaccess as instructed in the docs:

http://code.google.com/p/simpleinvoices/wiki/Config#Authentication

But it doesn't seem to work.

What version of the product are you using? On what operating system?

2011.1 - stable on OSX 10.7.3

Please provide any additional information below.

Here's a link to my original forum post:

http://www.simpleinvoices.org/forum/discussion/comment/10094/

I've since managed to get mysql based authentication working by setting:

authentication.enabled                          = true
authentication.http                             = false

Original issue reported on code.google.com by jonat...@kinobe.com on 10 Feb 2012 at 12:42

GoogleCodeExporter commented 9 years ago
Hi Jonathan,

Thank you for reporting this. I haven't had chance to test this but I think you 
are correct in identifying the getURL() function as the cause of the problem.

I think it may because the function seems to fetch the http value (which is 
true/false) and is trying to convert that to a string, therefore printing a 1 
when the value is true.

I will take a look into this further and see if we can get it fixed.

Matt

Original comment by MattAntW...@gmail.com on 13 Feb 2012 at 10:06