Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Plugin doesn't deal with full URL paths

#2

Hi again,

re. the previous ticket, I rolled back to your v.1.0 which isn't affected by the get_instance() issue so I could get things working.

However, it and v.2. are affected by only dealing with paths that don't contain the domain in the URL.

I added a little code to get around this for my purposes (an old Mark Huot gen. full domain path, e.g. http://www.site.com/path.file.ending)

Where you check and fix the file path in __construct(), if you add this:

else if (stristr($this->file, $_SERVER['SERVER_NAME']))
{
    $parts = parse_url($this->file);
    $this->file =  $_SERVER['DOCUMENT_ROOT'] . $parts['path'];
}

I think you should be okay. I am at least. Let me know if you can think of any potential issues I'm being blind to.

You may need to repeat that in v.2. in get_file_data() as your file checking code is repeated there. Not so in v.1.

Cheers,

Aidann

Reported by MarmaladeToday · February 28th, 2010 @ 07:58 PM

State: open
Milestone: none
Assigned to: George Ornbo George Ornbo

Activity

  1. Stephen
    Stephen
    • Tag set to custom field

    I'm trying to get data using a custom field. I believe I'm having a hard time because it doesn't support full urls.

    Could you please be more specific about where this code needs to go.

    thanks

    August 1st, 2010 @ 02:38 AM

  2. MarmaladeToday
    MarmaladeToday

    Sure Stephen.

    I added that code to version 1.0.0 for EE 1.6x at line 110, in the public function __construct() so that the file checking conditional from lines 106 onwards looks like this:

    if (stristr($this->file, $_SERVER['DOCUMENT_ROOT']))
    {

    $this->file =  $this->file;
    

    } else if (stristr($this->file, $_SERVER['SERVER_NAME']))
    {

    $parts = parse_url($this->file);
    $this->file =  $_SERVER['DOCUMENT_ROOT'] . $parts['path'];
    

    } else
    {

    $this->file = $_SERVER['DOCUMENT_ROOT'] . $this->file;
    

    }

    Hope that helps,

    Aidann

    August 1st, 2010 @ 01:19 PM

  3. MarmaladeToday
    MarmaladeToday

    Sorry, should have checked the formatting of that before posting. Let's try that again:

    if (stristr($this->file, $_SERVER['DOCUMENT_ROOT']))
    {
        $this->file =  $this->file;
    }
    else if (stristr($this->file, $_SERVER['SERVER_NAME']))
    {
        $parts = parse_url($this->file);
        $this->file =  $_SERVER['DOCUMENT_ROOT'] . $parts['path'];
    }
    else
    {
        $this->file = $_SERVER['DOCUMENT_ROOT'] . $this->file;          
    }
    

    August 1st, 2010 @ 01:21 PM

  4. Stephen
    Stephen
    • Tag changed from custom field to custom field, plugins page, white screen

    This helped a lot.

    This might be another ticket.
    I had to reinstall EE due to other issues. After I uploaded the file oracle plugin, I can't access my plugins page. I just get blank white screen. If I remove file oracle, my plugins page works fine.

    August 3rd, 2010 @ 10:24 PM

  5. Stephen
    Stephen

    I'm also on EE 2.1.0

    August 3rd, 2010 @ 11:29 PM

  6. MarmaladeToday
    MarmaladeToday

    Yes, this sounds like a different ticket.

    Which version of File Oracle are you using?

    v1 is for EE 1.x
    v2 is for EE 2.x

    August 4th, 2010 @ 12:13 PM

  7. George Ornbo
    George Ornbo
    • State changed from new to open

    Aidaan

    Thanks for that. You are right - the plugin doesn't currently support full paths.

    I'll roll your fix into the next release (no commitments on dates I'm afraid!)

    Stephen - it sounds like your issue is a PHP error. In order to find out what this if the error is in your control panel you can edit /system/index.php and set debug = 1 to display PHP errors.

    August 4th, 2010 @ 05:48 PM

  8. MarmaladeToday
    MarmaladeToday

    Hi George,

    Just thought I'd report that this fix is also needed (and appears to work) in both __construct() and get_file_data() too for the EE2 version.

    Aidann

    September 17th, 2010 @ 02:17 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.