コード例 #1
0
ファイル: utility.php プロジェクト: hackingman/TradeX
function get_config_defaults()
{
    global $C;
    require_once 'mailer.php';
    $domain = domain_from_url('http://' . $_SERVER['HTTP_HOST']);
    $defaults = array();
    $defaults['site_name'] = $domain;
    $defaults['traffic_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/index.shtml';
    $defaults['base_url'] = 'http://' . $_SERVER['HTTP_HOST'] . preg_replace('~/cp/.*~', '', $_SERVER['REQUEST_URI']);
    $defaults['cookie_domain'] = $domain;
    $defaults['cookie_path'] = preg_replace('~/cp/.*~', '', $_SERVER['REQUEST_URI']);
    $defaults['keyphrase'] = md5(uniqid(mt_rand(), true));
    $defaults['email_address'] = 'webmaster@' . $domain;
    $defaults['email_name'] = $domain;
    $defaults['date_format'] = 'm-d-Y';
    $defaults['time_format'] = 'h:i:s';
    $defaults['email_method'] = MAILER_METHOD_PHP;
    $defaults['captcha_min'] = '4';
    $defaults['captcha_max'] = '6';
    $defaults['flag_captcha_words'] = '1';
    $defaults['flag_accept_new_trades'] = '1';
    $defaults['flag_captcha_register'] = '1';
    $defaults['flag_allow_login'] = '******';
    $defaults['site_name_min'] = '10';
    $defaults['site_name_max'] = '50';
    $defaults['site_description_min'] = '10';
    $defaults['site_description_max'] = '500';
    $defaults['autostop_interval'] = '24';
    $defaults['flag_req_email'] = '1';
    $defaults['flag_req_site_name'] = '1';
    $defaults['flag_req_site_description'] = '';
    $defaults['flag_req_icq'] = '';
    $defaults['flag_req_nickname'] = '1';
    $defaults['flag_req_banner'] = '';
    $defaults['bonus_prod_low'] = '110';
    $defaults['bonus_prod_high'] = '150';
    $defaults['mod_bonus_prod'] = '105';
    $defaults['bonus_unique_low'] = '90';
    $defaults['bonus_unique_high'] = '98';
    $defaults['mod_bonus_unique'] = '105';
    $defaults['bonus_return_low'] = '0';
    $defaults['bonus_return_high'] = '90';
    $defaults['mod_bonus_return'] = '120';
    $defaults['penalty_proxy_low'] = '2';
    $defaults['penalty_proxy_high'] = '20';
    $defaults['mod_penalty_proxy'] = '90';
    $defaults['penalty_unique_low'] = '85';
    $defaults['penalty_unique_high'] = '98';
    $defaults['mod_penalty_unique'] = '90';
    $defaults['penalty_return_low'] = '0';
    $defaults['penalty_return_high'] = '175';
    $defaults['mod_penalty_return'] = '80';
    $defaults['distrib_forces'] = '30';
    $defaults['distrib_main'] = '50';
    $defaults['distrib_primary'] = '10';
    $defaults['distrib_secondary'] = '10';
    $defaults['toplist_rebuild_interval'] = '15';
    $defaults['fast_click'] = '1.25';
    $defaults['count_clicks'] = '10';
    $defaults['thumb_grab_interval'] = '12';
    $defaults['thumb_grab_amount'] = '3';
    $defaults['thumb_width_min'] = '75';
    $defaults['thumb_height_min'] = '75';
    $defaults['thumb_width_max'] = '400';
    $defaults['thumb_height_max'] = '400';
    $defaults['have_gd'] = 0;
    $defaults['have_magick'] = 0;
    $defaults['magick_mogrify_path'] = '';
    $defaults['magick_mogrify_options'] = '+profile "*" -format jpg -quality 80';
    $defaults['thumb_resize_width'] = '120';
    $defaults['thumb_resize_height'] = '160';
    $defaults['thumb_trigger_strings'] = 'thumbs/,tn/,thumbnails/';
    $C = array_merge($defaults, $C);
}
コード例 #2
0
ファイル: register.php プロジェクト: hackingman/TradeX
function _xRegister()
{
    global $t, $C;
    require_once 'validator.php';
    $_REQUEST = string_strip_tags($_REQUEST);
    $v =& Validator::Get();
    $v->Register($_REQUEST['return_url'], VT_VALID_HTTP_URL, "The 'URL to Send Traffic' field must be a valid HTTP URL");
    if (!string_is_empty($_REQUEST['return_url'])) {
        require_once 'http.php';
        $http = new HTTP();
        $v->Register($http->GET($_REQUEST['return_url'], null, true), VT_NOT_FALSE, "The 'URL to Send Traffic' does not seem to be working: " . $http->error);
        $_REQUEST['header'] = $http->response_headers;
        $_REQUEST['content'] = $http->body;
    }
    if ($C['flag_req_email'] || !empty($_REQUEST['email'])) {
        $v->Register($_REQUEST['email'], VT_VALID_EMAIL, "The 'E-mail Address' field must be a valid email");
    }
    if ($C['flag_req_site_name'] || !empty($_REQUEST['site_name'])) {
        $v->Register($_REQUEST['site_name'], VT_LENGTH_BETWEEN, "The 'Site Name' field must have between {$C['site_name_min']} and {$C['site_name_max']} characters", array($C['site_name_min'], $C['site_name_max']));
    }
    if ($C['flag_req_site_description'] || !empty($_REQUEST['site_description'])) {
        $v->Register($_REQUEST['site_description'], VT_LENGTH_BETWEEN, "The 'Site Description' field must have between {$C['site_description_min']} and {$C['site_description_max']} characters", array($C['site_description_min'], $C['site_description_max']));
    }
    if ($C['flag_req_icq'] || !empty($_REQUEST['icq'])) {
        $v->Register($_REQUEST['icq'], VT_IS_NUMERIC, "The 'ICQ Number' field must be numeric");
    }
    if ($C['flag_req_nickname'] || !empty($_REQUEST['nickname'])) {
        $v->Register($_REQUEST['nickname'], VT_NOT_EMPTY, "The 'Nickname' field is required");
    }
    if ($C['flag_req_banner'] || !empty($_REQUEST['banner'])) {
        $v->Register($_REQUEST['banner'], VT_VALID_HTTP_URL, "The 'Banner URL' field must be a valid HTTP URL");
        if (!string_is_empty($_REQUEST['banner'])) {
            require_once 'http.php';
            $http = new HTTP();
            $v->Register($http->GET($_REQUEST['banner'], null, true), VT_NOT_FALSE, "The 'Banner URL' does not seem to be working: " . $http->error);
        }
    }
    if ($C['flag_captcha_register']) {
        require_once 'captcha.php';
        $captcha = new Captcha();
        $captcha->Verify();
    }
    $_REQUEST['domain'] = domain_from_url($_REQUEST['return_url']);
    require_once 'dirdb.php';
    $db = new TradeDB();
    $v->Register($db->Exists($_REQUEST['domain']), VT_IS_FALSE, "The site you are trying to register already exists in our database");
    // Check blacklist
    $_REQUEST['server_ip'] = gethostbyname($domain);
    $_REQUEST['dns'] = gethostbyname($domain);
    if (($blacklisted = check_blacklist($_REQUEST)) !== false) {
        $v->SetError("You have matched one or more of our blacklist items and cannot register new trade accounts" . (!empty($blacklisted[1]) ? ": " . $blacklisted[1] : ''));
    }
    // Check category
    $categories = array_map('trim', file(FILE_CATEGORIES));
    if ($C['flag_allow_select_category'] && count($categories)) {
        $v->Register(in_array($_REQUEST['category'], $categories), VT_IS_TRUE, "You have selected an invalid category");
        $_REQUEST['categories'] = array($_REQUEST['category']);
    }
    if (!$v->Validate()) {
        $t->Assign('g_errors', $v->GetErrors());
        return _xRegisterShow();
    }
    $_REQUEST = array_merge($_REQUEST, unserialize(file_get_contents(FILE_NEW_TRADE_DEFAULTS)));
    $password = $_REQUEST['password'] = get_random_password();
    $t->AssignByRef('g_trade', $_REQUEST);
    trade_add($_REQUEST, true);
    $_REQUEST['password'] = $password;
    $t->Display('register-complete.tpl');
}
コード例 #3
0
ファイル: xhr.php プロジェクト: hackingman/TradeX
function _xTradesEdit()
{
    require_once 'dirdb.php';
    $db = new TradeDB();
    $domain = domain_from_url($_REQUEST['return_url']);
    $v = Validator::Get();
    $v->Register($_REQUEST['return_url'], VT_VALID_HTTP_URL, 'The Return URL must be a valid HTTP URL');
    if ($domain != $_REQUEST['domain']) {
        $v->Register($db->Exists($domain), VT_IS_FALSE, 'A trade already exists with the domain you are trying to edit');
    }
    if (!$v->Validate()) {
        return JSON::Warning(array(JSON_KEY_MESSAGE => 'Trade could not be edited; please fix the following items', JSON_KEY_WARNINGS => $v->GetErrors()));
    }
    $trade = $db->Retrieve($_REQUEST['domain']);
    if (!empty($trade)) {
        // Update owed instance forces, if necessary
        if ($trade['force_instant'] != $_REQUEST['force_instant']) {
            $_REQUEST['force_instant_owed'] = $_REQUEST['force_instant'];
        }
        // Update owed hourly forces, if necessary
        if ($trade['force_hourly'] != $_REQUEST['force_hourly']) {
            $_REQUEST['force_hourly_owed'] = $_REQUEST['force_hourly'];
        }
        if (empty($_REQUEST['force_hourly'])) {
            $_REQUEST['force_hourly_end'] = '';
        }
        // Domain change
        if ($domain != $_REQUEST['domain']) {
            $db->ChangePrimaryKey($_REQUEST['domain'], $domain);
            rename(DIR_TRADE_STATS . "/{$_REQUEST['domain']}", DIR_TRADE_STATS . "/{$domain}");
            rename(DIR_TRADE_STATS . "/{$_REQUEST['domain']}-in", DIR_TRADE_STATS . "/{$domain}-in");
            rename(DIR_TRADE_STATS . "/{$_REQUEST['domain']}-out", DIR_TRADE_STATS . "/{$domain}-out");
            rename(DIR_TRADE_STATS . "/{$_REQUEST['domain']}-clicks", DIR_TRADE_STATS . "/{$domain}-clicks");
            rename(DIR_TRADE_STATS . "/{$_REQUEST['domain']}-history", DIR_TRADE_STATS . "/{$domain}-history");
            $_REQUEST['domain'] = $domain;
        }
        $_REQUEST = trade_prepare_data($_REQUEST, true);
        unset($_REQUEST['thumbnails']);
        $db->Update($_REQUEST['domain'], $_REQUEST);
    }
    _xTradesEditShow('Trade has been successfully updated');
}