Re: 404 after sending mail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 20, 2010 at 2:16 PM, bob.33
<bob-old.nabble.com@xxxxxxxxxxxxx> wrote:
>
>
> Paul Lesniewski wrote:
>>
>> If you just want to paste in the new
>> php_self() function in functions/strings.php, here it is:
>>
>> function php_self () {
>>     if (sqgetGlobalVar('PHP_SELF', $php_self, SQ_SERVER)
>>      && !empty($php_self)) {
>>         if (sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER)
>>          && !empty($query_string)) {
>>             $php_self .= '?' . $query_string;
>>         }
>>         return $php_self;
>>     }
>>     else if (sqgetGlobalVar('REQUEST_URI', $req_uri, SQ_SERVER)
>>           && !empty($req_uri)) {
>>         if (strpos($req_uri, '?') === FALSE
>>          && sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER)
>>          && !empty($query_string)) {
>>             $req_uri .= '?' . $query_string;
>>         }
>>         return $req_uri;
>>     }
>>     return '';
>> }
>> --
>> Paul Lesniewski
>>
>
> bravo, my brothers!  that seems to have fixed everything.

Thanks for being so helpful.  I have slightly rewritten this function,
and although the ultimate functionality should be identical, it'd be
good to have other people test it.  Do you mind?  Here it is:

/**
 * php_self
 *
 * Attempts to determine the path and filename and any arguments
 * for the currently executing script.  This is usually found in
 * $_SERVER['REQUEST_URI'], but some environments may differ, so
 * this function tries to standardize this value.
 *
 * @since 1.2.3
 * @return string The path, filename and any arguments for the
 *                current script
 */
function php_self() {

    $request_uri = '';

    // first try $_SERVER['PHP_SELF'], which seems most reliable
    // (albeit it usually won't include the query string)
    //
    $request_uri = '';
    if (!sqgetGlobalVar('PHP_SELF', $request_uri, SQ_SERVER)
     || empty($request_uri)) {

        // well, then let's try $_SERVER['REQUEST_URI']
        //
        $request_uri = '';
        if (!sqgetGlobalVar('REQUEST_URI', $request_uri, SQ_SERVER)
         || empty($request_uri)) {

            // TODO: anyone have any other ideas?  maybe
$_SERVER['SCRIPT_NAME']???
            //
            return '';
        }

    }

    // we may or may not have any query arguments, depending on
    // which environment variable was used above, and the PHP
    // version, etc., so let's check for it now
    //
    $query_string = '';
    if (strpos($request_uri, '?') === FALSE
     && sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER)
     && !empty($query_string)) {

        $request_uri .= '?' . $query_string;
    }

    return $request_uri;

}

-- 
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
-----
squirrelmail-users mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List archives: http://news.gmane.org/gmane.mail.squirrelmail.user
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-users


[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux