Exemple #1
0
function _xCronGrabThumbs()
{
    global $start;
    CronAppendLog(FILE_LOG_GRABBER, 'Grabber starting...', true);
    require_once 'dirdb.php';
    $db = new TradeDB();
    foreach ($db->RetrieveAll() as $trade) {
        if ($trade['flag_grabber']) {
            if (string_is_empty($trade['grabber_url'])) {
                $trade['grabber_url'] = $trade['return_url'];
            }
            $thumbnails = grab_thumbs($trade['domain'], $trade['grabber_url'], $trade['trigger_strings']);
            switch ($thumbnails) {
                case null:
                    CronAppendLog(FILE_LOG_GRABBER, 'Thumbnails could not be downloaded from ' . $trade['domain']);
                    break;
                case 0:
                    CronAppendLog(FILE_LOG_GRABBER, 'HTTP connection for ' . $trade['domain'] . ' has failed');
                    break;
                default:
                    $db->Update($trade['domain'], array('thumbnails' => $thumbnails));
                    break;
            }
        }
    }
    CronAppendLog(FILE_LOG_GRABBER, 'Grabber exiting...', true);
}
Exemple #2
0
function _xSync()
{
    $settings = unserialize(base64_decode($_REQUEST['sync']));
    // Sync blacklist
    if (isset($settings[NETWORK_SYNC_BLACKLIST]) && is_array($settings[NETWORK_SYNC_BLACKLIST])) {
        foreach ($settings[NETWORK_SYNC_BLACKLIST] as $bl_file => $file_contents) {
            file_write(DIR_BLACKLIST . '/' . $bl_file, $file_contents);
        }
    }
    // Sync categories
    if (isset($settings[NETWORK_SYNC_CATEGORIES])) {
        file_write(FILE_CATEGORIES, $settings[NETWORK_SYNC_CATEGORIES]);
    }
    // Sync countries
    if (isset($settings[NETWORK_SYNC_COUNTRIES])) {
        file_write(FILE_COUNTRIES, $settings[NETWORK_SYNC_COUNTRIES]);
    }
    // Sync groups
    if (isset($settings[NETWORK_SYNC_GROUPS])) {
        file_write(FILE_GROUPS, $settings[NETWORK_SYNC_GROUPS]);
    }
    // Sync network sites
    if (isset($settings[NETWORK_SYNC_NETWORK_SITES]) && is_array($settings[NETWORK_SYNC_NETWORK_SITES])) {
        require_once 'textdb.php';
        $db = new NetworkDB();
        foreach ($settings[NETWORK_SYNC_NETWORK_SITES] as $site) {
            if ($db->Exists($site['domain'])) {
                $db->Update($site['domain'], $site);
            } else {
                $db->Add($site);
            }
        }
        network_site_update_stored_values();
    }
    // Sync search engines
    if (isset($settings[NETWORK_SYNC_SEARCH_ENGINES])) {
        file_write(FILE_SEARCH_ENGINES, $settings[NETWORK_SYNC_SEARCH_ENGINES]);
    }
    // Sync skim schemes
    if (isset($settings[NETWORK_SYNC_SKIM_SCHEMES]) && is_array($settings[NETWORK_SYNC_SKIM_SCHEMES])) {
        foreach ($settings[NETWORK_SYNC_SKIM_SCHEMES] as $scheme => $ss_file) {
            file_write(DIR_SKIM_SCHEMES . '/' . $scheme, $ss_file['merged']);
            file_write(DIR_SKIM_SCHEMES_BASE . '/' . $scheme, $ss_file['base']);
            file_write(DIR_SKIM_SCHEMES_DYNAMIC . '/' . $scheme, $ss_file['dynamic']);
        }
    }
    // Sync trades
    if (isset($settings[NETWORK_SYNC_TRADES]) && is_array($settings[NETWORK_SYNC_TRADES])) {
        require_once 'dirdb.php';
        $db = new TradeDB();
        foreach ($settings[NETWORK_SYNC_TRADES] as $trade) {
            if ($db->Exists($trade['domain'])) {
                // Update existing
                $db->Update($trade['domain'], $trade);
            } else {
                // Create new, no confirmation
                $trade['flag_confirm'] = 0;
                trade_add($trade);
            }
        }
    }
    // Sync trade rules
    if (isset($settings[NETWORK_SYNC_TRADE_RULES])) {
        file_write(FILE_TRADE_RULES, $settings[NETWORK_SYNC_TRADE_RULES]);
    }
    network_success(true);
}
Exemple #3
0
function _xForgotPasswordConfirmed()
{
    global $t, $C;
    require_once 'textdb.php';
    $db = new PasswordConfirmsDB();
    $db->DeleteExpired();
    $confirm = $db->Retrieve($_REQUEST['id']);
    require_once 'validator.php';
    $v =& Validator::Get();
    $v->Register(empty($confirm), VT_IS_FALSE, 'Invalid or expired confirmation code');
    if (!$v->Validate()) {
        $t->Assign('g_invalid_confirm', true);
    } else {
        $db->Delete($_REQUEST['id']);
        $password = get_random_password();
        require_once 'dirdb.php';
        $db = new TradeDB();
        $trade = $db->Update($confirm['domain'], array('password' => sha1($password)));
        $trade['password'] = $password;
        $t->AssignByRef('g_trade', $trade);
    }
    $t->Display('trade-stats-forgot-confirmed.tpl');
}
Exemple #4
0
function _xConfirmShow()
{
    global $t, $C;
    require_once 'textdb.php';
    $db = new RegisterConfirmsDB();
    $db->DeleteExpired();
    $confirm = $db->Retrieve($_REQUEST['id']);
    require_once 'validator.php';
    $v =& Validator::Get();
    $v->Register(empty($confirm), VT_IS_FALSE, 'Invalid or expired confirmation code');
    if (!$v->Validate()) {
        $t->Assign('g_invalid_confirm', true);
    } else {
        $db->Delete($_REQUEST['id']);
        $defaults = unserialize(file_get_contents(FILE_NEW_TRADE_DEFAULTS));
        require_once 'dirdb.php';
        $password = get_random_password();
        $db = new TradeDB();
        $trade = $db->Update($confirm['domain'], array('status' => $defaults['status'], 'timestamp_autostop' => time(), 'password' => sha1($password)));
        $trade['password'] = $password;
        $t->AssignByRef('g_trade', $trade);
        require_once 'mailer.php';
        if ($C['flag_register_email_user'] && !string_is_empty($trade['email'])) {
            $m = new Mailer();
            $m->Mail('email-register-complete.tpl', $t, $trade['email'], $trade['email']);
        }
        if ($C['flag_register_email_admin']) {
            $m = new Mailer();
            $m->Mail('email-register-admin.tpl', $t, $C['email_address'], $C['email_name']);
        }
    }
    $t->Display('register-confirm.tpl');
}
Exemple #5
0
<?php

include 'global-header.php';
include 'global-menu.php';
$values = unserialize(file_get_contents(FILE_NETWORK_SITES_VALUES));
$cache = unserialize(file_get_contents(FILE_NETWORK_SITES_CACHE));
require_once 'network-util.php';
require_once 'textdb.php';
require_once 'dirdb.php';
$db = new NetworkDB();
$sites = $db->RetrieveAll('domain');
$db = new TradeDB();
$trades = $db->RetrieveAll('domain');
?>
    <script type="text/javascript" src="js/network-sync.js"></script>


    <div class="centered-header">
      Sync Network Sites
    </div>


    <!-- SYNC PROGRESS START -->
    <fieldset style="margin: 8px auto 30px; display: none;" id="sync-progress">
      <legend>Sync Progress</legend>

      <div id="sync-current" class="message-notice ta-center va-middle">
        <img src="images/activity-16x16.gif"/>
        <span>Syncing <span id="sync-site"></span> (<span id="sync-num-done"></span> of <span id="sync-num-total"></span>)</span>
      </div>
Exemple #6
0
function trade_delete($domains)
{
    require_once 'dirdb.php';
    if (!is_array($domains)) {
        $domains = array($domains);
    }
    $db = new TradeDB();
    foreach ($domains as $domain) {
        $trade = $db->Retrieve($domain);
        if ($_REQUEST['flag_blacklist_domain']) {
            file_append(FILE_BLACKLIST_DOMAIN, "{$domain}|{$_REQUEST['blacklist_reason']}\n");
        }
        if ($_REQUEST['flag_blacklist_server_ip'] && ($ip = gethostbyname($domain)) != $domain) {
            file_append(FILE_BLACKLIST_SERVER_IP, "{$ip}|{$_REQUEST['blacklist_reason']}\n");
        }
        if ($_REQUEST['flag_blacklist_email'] && !string_is_empty($trade['email'])) {
            file_append(FILE_BLACKLIST_EMAIL, "{$trade['email']}|{$_REQUEST['blacklist_reason']}\n");
        }
        $db->Delete($domain);
        file_delete(DIR_TRADE_STATS . "/{$domain}");
        file_delete(DIR_TRADE_STATS . "/{$domain}-clicks");
        file_delete(DIR_TRADE_STATS . "/{$domain}-history");
        file_delete(DIR_TRADE_STATS . "/{$domain}-in");
        file_delete(DIR_TRADE_STATS . "/{$domain}-out");
        if ($trade['thumbnails'] > 0) {
            for ($i = 1; $i <= $trade['thumbnails']; $i++) {
                file_delete(DIR_THUMBS . "/{$domain}-{$i}.jpg");
            }
        }
    }
}
Exemple #7
0
function _xTradesInfoBox()
{
    require_once 'dirdb.php';
    $db = new TradeDB();
    $trade = $db->Retrieve($_REQUEST['trade']);
    JSON::Success(array(JSON_KEY_HTML => _xIncludeCapture('trades-info-box.php', $trade)));
}