示例#1
0
function iqblockcountry_upgrade()
{
    /* Check if update is necessary */
    $dbversion = get_option('blockcountry_version');
    update_option('blockcountry_version', VERSION);
    if ($dbversion != "" && version_compare($dbversion, "1.1.21", '<')) {
        if (!get_option('blockcountry_geoapilocation')) {
            iqblockcountry_find_geoip_location();
        }
    } elseif ($dbversion != "" && version_compare($dbversion, "1.1.19", '<')) {
        update_option('blockcountry_blocksearch', 'on');
    }
    if ($dbversion != "" && version_compare($dbversion, "1.1.17", '<')) {
        delete_option('blockcountry_automaticupdate');
        delete_option('blockcountry_lastupdate');
    } elseif ($dbversion != "" && version_compare($dbversion, "1.1.11", '<')) {
        update_option('blockcountry_nrstatistics', 15);
    } elseif ($dbversion != "" && version_compare($dbversion, "1.0.10", '<')) {
        $frontendbanlist = get_option('blockcountry_banlist');
        update_option('blockcountry_backendbanlist', $frontendbanlist);
        update_option('blockcountry_backendnrblocks', 0);
        update_option('blockcountry_frontendnrblocks', 0);
        update_option('blockcountry_header', 'on');
    } elseif ($dbversion != "" && version_compare($dbversion, "1.0.10", '=')) {
        iqblockcountry_install_db();
        update_option('blockcountry_backendnrblocks', 0);
        update_option('blockcountry_frontendnrblocks', 0);
        update_option('blockcountry_header', 'on');
    } elseif ($dbversion == "") {
        iqblockcountry_install_db();
        add_option("blockcountry_dbversion", DBVERSION);
        update_option('blockcountry_blockfrontend', 'on');
        update_option('blockcountry_version', VERSION);
        update_option('blockcountry_backendnrblocks', 0);
        update_option('blockcountry_frontendnrblocks', 0);
        update_option('blockcountry_header', 'on');
        $frontendbanlist = get_option('blockcountry_banlist');
        update_option('blockcountry_backendbanlist', $frontendbanlist);
    }
    iqblockcountry_update_db_check();
}
示例#2
0
function iqblockcountry_set_defaults()
{
    update_option('blockcountry_version', VERSION);
    $countrylist = iqblockcountry_get_countries();
    $ip_address = iqblockcountry_get_ipaddress();
    $usercountry = iqblockcountry_check_ipaddress($ip_address);
    if (get_option('blockcountry_blockfrontend') === FALSE) {
        update_option('blockcountry_blockfrontend', 'on');
    }
    if (get_option('blockcountry_backendnrblocks') === FALSE) {
        update_option('blockcountry_backendnrblocks', 0);
    }
    if (get_option('blockcountry_frontendnrblocks') === FALSE) {
        update_option('blockcountry_frontendnrblocks', 0);
    }
    if (get_option('blockcountry_header') === FALSE) {
        update_option('blockcountry_header', 'on');
    }
    if (get_option('blockcountry_nrstatistics') === FALSE) {
        update_option('blockcountry_nrstatistics', 15);
    }
    if (get_option('blockcountry_backendwhitelist') === FALSE || get_option('blockcountry_backendwhitelist') == "") {
        update_option('blockcountry_backendwhitelist', $ip_address);
    }
    iqblockcountry_install_db();
    iqblockcountry_find_geoip_location();
}