Пример #1
0
function JB_process_xml_import()
{
    $sql = "SELECT feed_id FROM xml_import_feeds WHERE `cron`='Y' AND `status`='READY' AND `pickup_method`!='POST' ";
    $result = jb_mysql_query($sql);
    if (mysql_num_rows($result) > 0) {
        require_once dirname(__FILE__) . '/xml_import_functions.php';
        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $importer = new xmlFeedImporter($row['feed_id']);
            $importer->import();
        }
    }
}
Пример #2
0
*/
if (!is_numeric($_REQUEST['feed_id'])) {
    die('feed_id parameter not present');
} else {
    $feed_id = $_REQUEST['feed_id'];
}
$importer = new xmlFeedImporter($feed_id);
if ($importer->feed_row['pickup_method'] == 'POST') {
    $hosts = array();
    $hosts = explode(',', $importer->feed_row['ip_allow']);
    $allowed = false;
    if (sizeof($hosts) > 0) {
        foreach ($hosts as $host) {
            if (strtoupper($host) == 'ALL') {
                // all hosts
                $allowed = true;
            }
            if (strtolower($host) == 'localhost' && $_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
                $allowed = true;
            }
            if ($host == $_SERVER['REMOTE_ADDR']) {
                $allowed = true;
            }
        }
        if (!$allowed) {
            $importer->set_import_error('Blocked access from: ' . $_SERVER['REMOTE_ADDR']);
            die('Access is restricted form your IP. Please contact ' . JB_SITE_CONTACT_EMAIL);
        }
    }
    $importer->import();
}