/**
 * Redirect to another page or site
 * @param string The url to redirect to
*/
function zen_redirect($url)
{
    global $request_type;
    if (ENABLE_SSL == true && $request_type == 'SSL') {
        // We are loading an SSL page
        if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) {
            // NONSSL url
            $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER));
            // Change it to SSL
        }
    }
    // clean up URL before executing it
    while (strstr($url, '&&')) {
        $url = str_replace('&&', '&', $url);
    }
    while (strstr($url, '&&')) {
        $url = str_replace('&&', '&', $url);
    }
    // header locates should not have the & in the address it breaks things
    while (strstr($url, '&')) {
        $url = str_replace('&', '&', $url);
    }
    header('Location: ' . $url);
    zen_exit();
}
Пример #2
0
/**
 * Redirect to another page or site
 * @param string The url to redirect to
*/
function zen_redirect($url)
{
    if ($url == FILENAME_LOGIN) {
        $_SESSION['loginfrom'] = $_SERVER['REQUEST_URI'];
    }
    if (ENABLE_SSL == true && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        // We are loading an SSL page
        if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) {
            // NONSSL url
            $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER));
            // Change it to SSL
        }
    }
    // clean up URL before executing it
    while (strstr($url, '&&')) {
        $url = str_replace('&&', '&', $url);
    }
    while (strstr($url, '&&')) {
        $url = str_replace('&&', '&', $url);
    }
    // header locates should not have the & in the address it breaks things
    while (strstr($url, '&')) {
        $url = str_replace('&', '&', $url);
    }
    header('Location: ' . $url);
    zen_exit();
}
Пример #3
0
/**
 * Redirect to another page or site
 * @param string The url to redirect to
*/
function zen_redirect($url)
{
    global $request_type;
    // Are we loading an SSL page?
    if (ENABLE_SSL == true && $request_type == 'SSL') {
        // yes, but a NONSSL url was supplied
        if (substr($url, 0, strlen(HTTP_SERVER . DIR_WS_CATALOG)) == HTTP_SERVER . DIR_WS_CATALOG) {
            // So, change it to SSL, based on site's configuration for SSL
            $url = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . substr($url, strlen(HTTP_SERVER . DIR_WS_CATALOG));
        }
    }
    // clean up URL before executing it
    while (strstr($url, '&&')) {
        $url = str_replace('&&', '&', $url);
    }
    while (strstr($url, '&&')) {
        $url = str_replace('&&', '&', $url);
    }
    // header locates should not have the & in the address it breaks things
    while (strstr($url, '&')) {
        $url = str_replace('&', '&', $url);
    }
    header('Location: ' . $url);
    zen_exit();
}
Пример #4
0
    }
    $disabled_funcs = @ini_get("disable_functions");
    if (DOWNLOAD_IN_CHUNKS != 'true' && !strstr($disabled_funcs, 'readfile')) {
        $zco_notifier->notify('NOTIFY_DOWNLOAD_WITHOUT_REDIRECT___COMPLETED', $origin_filename);
        // This will work on all systems, but will need considerable resources
        readfile(DIR_FS_DOWNLOAD . $origin_filename);
    } else {
        // override PHP timeout to 25 minutes, if allowed
        @set_time_limit(1500);
        $zco_notifier->notify('NOTIFY_DOWNLOAD_IN_CHUNKS___COMPLETED', $origin_filename);
        // loop with fread($fp, xxxx) to allow streaming in chunk sizes below the PHP memory_limit
        $handle = @fopen(DIR_FS_DOWNLOAD . $origin_filename, "rb");
        if ($handle) {
            while (!@feof($handle)) {
                echo fread($handle, 4096);
                @flush();
            }
            fclose($handle);
        } else {
            // Throw error condition -- this should never happen!
            $messageStack->add_session('default', 'Please contact store owner.  ERROR: Cannot read file: ' . $origin_filename, 'error');
            zen_mail('', STORE_OWNER_EMAIL_ADDRESS, ERROR_CUSTOMER_DOWNLOAD_FAILURE, "Unable to open file '" . $origin_filename . " for reading.  Check the file permissions.", STORE_NAME, EMAIL_FROM);
        }
        $zco_notifier->notify('NOTIFY_DOWNLOAD_WITHOUT_REDIRECT_VIA_CHUNKS___COMPLETED');
    }
}
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_DOWNLOAD');
// finally, upon completion of the download, the script should end here and not attempt to display any template components etc.
zen_exit();