Example #1
0
function baseurl()
{
    $baseurl = 'http' . (is_secure() ? 's' : '') . '://' . $_SERVER["SERVER_NAME"];
    $baseurl .= !in_array($_SERVER["SERVER_PORT"], array('80', '443')) ? ':' . $_SERVER["SERVER_PORT"] : '';
    $baseurl .= dirname($_SERVER["SCRIPT_NAME"]);
    return $baseurl;
}
Example #2
0
function get_base()
{
    if (isset($_SERVER['HTTP_HOST']) && preg_match('/^((\\[[0-9a-f:]+\\])|(\\d{1,3}(\\.\\d{1,3}){3})|[a-z0-9\\-\\.]+)(:\\d+)?$/i', $_SERVER['HTTP_HOST'])) {
        $base_url = (is_secure() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
    } else {
        $base_url = 'http://localhost/';
    }
    return rtrim($base_url, '/') . '/';
}
Example #3
0
 function _check_secure($controller)
 {
     if (function_exists("is_secure")) {
         if (is_secure($controller)) {
             if (function_exists("check_secure")) {
                 check_secure($controller);
             }
         }
     }
 }
 function customer_profile()
 {
     $form_name = $this->EE->TMPL->fetch_param('form_name', 'profile_edit');
     $form_id = $this->EE->TMPL->fetch_param('form_id', 'profile_edit');
     $form_class = $this->EE->TMPL->fetch_param('form_class', 'profile_edit');
     $return = $this->EE->TMPL->fetch_param('return');
     // By default we look for the logged in user
     // but we can also passs the member_id param
     $member_id = $this->EE->TMPL->fetch_param('member_id') ? $this->EE->TMPL->fetch_param('member_id') : $this->EE->session->userdata["member_id"];
     // We don't have a member to get info for
     if ($member_id == 0) {
         return '';
     }
     $this->EE->load->model('customer_model');
     $member = $this->EE->customer_model->get_customer_profile($member_id);
     if ($member) {
         $vars[0] = $member;
         $action = $this->EE->functions->fetch_site_index(0, 0) . QUERY_MARKER . 'ACT=' . $this->EE->functions->fetch_action_id('Brilliant_retail', 'customer_profile_update');
         if (is_secure()) {
             $action = str_replace("http://", "https://", $action);
         }
         $form_details = array('action' => $action, 'name' => $form_name, 'id' => $form_id, 'class' => $form_class, 'hidden_fields' => array('return' => $return));
         $vars[0]["form_open"] = $this->EE->functions->form_declaration($form_details);
         $vars[0]["form_close"] = '</form>';
         $output = $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $vars);
         // Are we showing our JS by default?
         $show_js = $this->EE->TMPL->fetch_param('show_js') ? $this->EE->TMPL->fetch_param('show_js') : TRUE;
         if ($show_js === TRUE) {
             $countries = $this->EE->product_model->get_countries();
             $map = json_encode($this->EE->product_model->get_states($countries));
             $this->js("\t\$(function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\$('#profile_edit').validate();\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t// get all tied selects\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar selects = \$('select[data-br_country]'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcountry_state_map = " . $map . ";\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tselects.each(function() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar select = \$(this),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcountry = \$( '#'+select.data('br_country') );\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// when the country changes, populate the states\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// trigger the first change right away to update\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcountry.change(function() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar str = '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcountry = this.options[this.selectedIndex].text;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$.each(country_state_map[country], function(k, v) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstr += '<option value=\"'+k+'\">'+v+'</option>';\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselect.empty().append(str);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselect.val(select.data('br_selected'));\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}).triggerHandler('change');\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t});");
         }
         $this->return_data = $output;
     }
     return $this->return_data;
 }
Example #5
0
    ff_renameproject($username, $id, $_REQUEST["newname"]);
    header("Location: {$GLOBALS['SITE_URL']}" . projurl($id, "tab=" . urlencode($tab)));
    exit;
} else {
    if (isset($_REQUEST["delete"])) {
        list($rc, $err) = ff_deleteproject($username, $id);
        header("Location: {$GLOBALS['SITE_URL']}" . projurl($id, "tab=" . urlencode($tab)));
        exit;
    } else {
        if (isset($_REQUEST["canceldel"])) {
            list($rc, $err) = ff_canceldeleteproject($username, $id);
            header("Location: {$GLOBALS['SITE_URL']}" . projurl($id, "tab=" . urlencode($tab)));
            exit;
        } else {
            if (isset($_REQUEST["sponsor_amount"])) {
                if (!is_secure()) {
                    header("Location: {$GLOBALS['SITE_URL']}" . projurl($id, "tab=" . urlencode($tab) . "&sp_err=1"));
                    exit;
                }
                $amount = '';
                list($rc, $currencies) = ff_currencies();
                if (!$rc) {
                    if (!isset($currencies[$_REQUEST["currency"]])) {
                        exit;
                    }
                    $currency = $currencies[$_REQUEST["currency"]];
                    $amount = round($_REQUEST["sponsor_amount"] * $currency["multiplier"]) . $currency["code"];
                    list($rc, $err) = ff_setsponsorship($id, $username, $amount, true);
                }
                header("Location: {$GLOBALS['SITE_URL']}" . projurl($id, "tab=" . urlencode($tab) . "&sp_err={$rc}&amount={$amount}"));
                exit;
Example #6
0
/* BEGIN MANDATORY CONFIGURATION */
/* The following variables are configured automatically with the installation wizard. */
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|	http://example.com/
|
*/
$config['base_url'] = "";
// rewrite base URL to SSL if accessed via SSL
if (is_secure()) {
    $config['base_url'] = str_replace('http://', 'https://', $config['base_url']);
}
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Sessions class with encryption
| enabled you MUST set an encryption key.  See the user guide for info.
|
*/
$config['encryption_key'] = "10101010101010101010101010";
$config['cron_key'] = '0000000000000000';
/* END MANDATORY CONFIGURATION */
/*
Example #7
0
{
    return str_replace('https://', 'http://', $url);
}
// new releases of Hero define this in the config file
if (!function_exists('is_secure')) {
    function is_secure()
    {
        if (isset($_SERVER['SERVER_PORT']) and $_SERVER['SERVER_PORT'] == '443') {
            return TRUE;
        } elseif (isset($_SERVER['HTTP_X_FORWARDED_PORT']) and $_SERVER['HTTP_X_FORWARDED_PORT'] == '443') {
            return TRUE;
        } elseif (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
            return TRUE;
        } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
            return TRUE;
        }
        return FALSE;
    }
}
// never redirect the user_activity controller!
if ($CI->uri->segment(2) != 'user_activity') {
    if ($CI->config->item('ssl_certificate') == '1') {
        if (in_array($CI->uri->segment(1), $CI->config->item('secure_modules')) and !is_secure()) {
            header("Location: " . secure(current_url()));
            die;
        } elseif (!in_array($CI->uri->segment(1), $CI->config->item('secure_modules')) and is_secure()) {
            header('Location: ' . unsecure(current_url()));
            die;
        }
    }
}
Example #8
0
function protocol()
{
    return is_secure() ? 'https' : 'http';
}
Example #9
0
    $sponsorships = array();
    foreach ($_REQUEST as $name => $value) {
        if (substr($name, 0, 7) === 'amount_') {
            $val = round($value * $currency["multiplier"]) . $currency["code"];
            if (ereg("[1-9]", $val)) {
                $sponsorships[substr($name, 7)] = $val;
            }
        }
    }
    list($rc, $err) = ff_setsubscription($username, "{$amount}{$currency['code']}", "monthly", $sponsorships);
    header("Location: {$GLOBALS['SITE_URL']}account.php?tab=subscription" . ($rc ? "&err=syserr" : ""));
    exit;
}
if (isset($_REQUEST['withdraw'])) {
    list($rc, $currencies) = ff_currencies();
    if (!is_secure() || $rc || !isset($currencies[$_REQUEST["currency"]])) {
        header("Location: {$GLOBALS['SITE_URL']}" . "account.php?tab=reserve&err=syserr");
        exit;
    }
    $currency = $currencies[$_REQUEST["currency"]];
    $amount = round($_REQUEST["withdraw"] * $currency["multiplier"]) . $currency["code"];
    $email = $_REQUEST["email"];
    if (ereg("[^-._+a-zA-Z0-9@]", $email)) {
        header("Location: {$GLOBALS['SITE_URL']}" . "account.php?tab=reserve&err=bademail");
        exit;
    }
    list($rc, $err) = ff_requestwithdrawal($username, $email, $amount);
    if ($rc == 9) {
        header("Location: {$GLOBALS['SITE_URL']}" . "account.php?tab=reserve&err=toomuch");
        exit;
    } else {