}
//create the tables
$schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'spam_word' => array('datatype' => 'VARCHAR(255)', 'allow_null' => true), 'replace_word' => array('datatype' => 'VARCHAR(255)', 'allow_null' => true), 'ban_type' => array('datatype' => 'VARCHAR(1)', 'allow_null' => true)), 'PRIMARY KEY' => array('id'));
$db->create_table('illegal_words', $schema);
$schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'father_id' => array('datatype' => 'INT(10) UNSIGNED', 'allow_null' => false, 'default' => '0'), 'title' => array('datatype' => 'VARCHAR(100)', 'allow_null' => true), 'description' => array('datatype' => 'TEXT', 'allow_null' => true), 'active' => array('datatype' => 'TINYINT(1) UNSIGNED', 'allow_null' => true), 'last_update' => array('datatype' => 'TIMESTAMP', 'allow_null' => true), 'created' => array('datatype' => 'DATE', 'allow_null' => true), 'ip' => array('datatype' => 'VARCHAR(15)', 'allow_null' => true), 'position' => array('datatype' => 'INT(10) UNSIGNED', 'allow_null' => false, 'default' => '0')), 'PRIMARY KEY' => array('id'));
$db->create_table('categories', $schema);
$schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'name' => array('datatype' => 'VARCHAR(100)', 'allow_null' => true), 'email' => array('datatype' => 'VARCHAR(150)', 'allow_null' => true), 'url' => array('datatype' => 'VARCHAR(255)', 'allow_null' => true), 'title' => array('datatype' => 'VARCHAR(255)', 'allow_null' => true), 'description' => array('datatype' => 'TEXT', 'allow_null' => true), 'active' => array('datatype' => 'TINYINT(1) UNSIGNED', 'allow_null' => true), 'ip' => array('datatype' => 'VARCHAR(15)', 'allow_null' => true), 'category_id' => array('datatype' => 'INT(10) UNSIGNED', 'allow_null' => true), 'date_submitted' => array('datatype' => 'TIMESTAMP', 'allow_null' => false, 'default' => 'CURRENT_TIMESTAMP'), 'reciprocal_url' => array('datatype' => 'VARCHAR(255)', 'allow_null' => true), 'type' => array('datatype' => 'VARCHAR(50)', 'allow_null' => true), 'payment_status' => array('datatype' => 'VARCHAR(50)', 'allow_null' => true), 'position' => array('datatype' => 'INT(10) UNSIGNED', 'allow_null' => false, 'default' => '0')), 'PRIMARY KEY' => array('id'));
$db->create_table('links', $schema);
$schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'ip' => array('datatype' => 'VARCHAR(15)', 'allow_null' => false, 'default' => '""')), 'PRIMARY KEY' => array('id'));
$db->create_table('ip_bans', $schema);
$schema = array('FIELDS' => array('id' => array('datatype' => 'SERIAL', 'allow_null' => false), 'title' => array('datatype' => 'VARCHAR(100)', 'allow_null' => false, 'default' => '""'), 'value' => array('datatype' => 'VARCHAR(255)', 'allow_null' => false, 'default' => '""')), 'PRIMARY KEY' => array('id'));
$db->create_table('settings', $schema);
$schema = array('FIELDS' => array('id' => array('datatype' => 'VARCHAR(150)', 'allow_null' => false, 'default' => '""'), 'title' => array('datatype' => 'VARCHAR(150)', 'allow_null' => false, 'default' => '""'), 'version' => array('datatype' => 'VARCHAR(25)', 'allow_null' => false, 'default' => '""'), 'description' => array('datatype' => 'TEXT', 'allow_null' => true), 'author' => array('datatype' => 'VARCHAR(50)', 'allow_null' => false, 'default' => '""'), 'uninstall' => array('datatype' => 'TEXT', 'allow_null' => true)), 'PRIMARY KEY' => array('id'));
$db->create_table('extensions', $schema);
$schema = array('FIELDS' => array('id' => array('datatype' => 'VARCHAR(150)', 'allow_null' => false, 'default' => '""'), 'extension_id' => array('datatype' => 'VARCHAR(150)', 'allow_null' => false, 'default' => '""'), 'code' => array('datatype' => 'TEXT', 'allow_null' => true), 'installed' => array('datatype' => 'INT(10) UNSIGNED', 'allow_null' => false, 'default' => '0')), 'PRIMARY KEY' => array('id', 'extension_id'));
$db->create_table('extension_hooks', $schema);
// Make sure base_url doesn't end with a slash
$_POST['site_domain'] = remove_last_slash($_POST['site_domain']);
//Now, we will implement the settings
$config = array('admin_username' => $db->escape($_POST['admin_username']), 'admin_password' => openld_hash($_POST['admin_password']), 'title' => $db->escape($_POST['site_title']), 'description' => $db->escape($_POST['site_description']), 'email' => $db->escape($_POST['admin_email']), 'domain' => $db->escape($_POST['site_domain']), 'links_sorting_by' => "title", 'categories_sorting_by' => "title", 'number_of_colums' => "2", 'number_of_links_per_page' => "20", 'number_of_search_results_per_page' => "20", 'link_title_max_length' => "255", 'link_title_min_length' => "2", 'link_url_max_length' => "255", 'link_url_min_length' => "2", 'link_description_max_length' => "1024", 'link_description_min_length' => "0", 'category_description_max_length' => "1024", 'category_description_min_length' => "0", 'reciprocal_links_option' => "N", 'reciprocal_url_option' => $db->escape($_POST['site_domain']), 'regular_links_option' => "Y", 'paid_links_option' => "N", 'sponsor_links_option' => "N", 'template_path' => "default/", 'admin_template_path' => "default/", 'language' => "english", 'auto_accept_links' => "N", 'display_unaccepted_links' => "N", 'display_unaccepted_categories' => "N", 'disable_extensions' => "N", 'payments' => 'paypal', 'paid_price_option' => '1', 'paid_curr_option' => 'USD', 'paid_account_option' => $db->escape($_POST['admin_email']), 'sponsor_price_option' => '5', 'sponsor_curr_option' => 'USD', 'sponsor_account_option' => $db->escape($_POST['admin_email']), 'rewrite_layer' => 'off', 'gzip' => 'N', 'hide_admin_button' => 'N', 'deny_index_page_submissions' => 'N', 'open_links_in_new_windows' => 'N');
while (list($conf_name, $conf_value) = @each($config)) {
    $query = array('INSERT' => 'title, value', 'INTO' => 'settings', 'VALUES' => '"' . $conf_name . '","' . $conf_value . '"');
    $db->query_build($query) or error('Unable to insert into table ' . $db_prefix . 'settings. Please check your configuration and try again. Failing values: "' . $conf_name . '", "' . $conf_value . '"', __FILE__, __LINE__);
}
//generate settings cache
generate_settings_cache();
// install extensions by default - list all below
install_extension('support_openld');
if ($db_type == 'pgsql' || $db_type == 'sqlite') {
    $db->end_transaction();
}
$currency = array('USD' => 'US Dollar', 'CAD' => 'Canadian Dollar', 'EUR' => 'EU Euros', 'GBP' => 'British Pound', 'JPY' => 'Japanese Yen', 'AUD' => 'Australian Dollar', 'CHF' => 'Swiss Franc', 'NOK' => 'Norwegian Kroner', 'SEK' => 'Swedish Kronor', 'PLN' => 'Polish Zloty', 'HUF' => 'Hungarian Forint', 'CZK' => 'Czech Koruna', 'SGD' => 'Singapore Dollar', 'NZD' => 'New Zealand Dollar');
($hook = get_hook('admin_options_before_input_check')) ? eval($hook) : null;
if (!empty($_POST) && (!isset($_POST['password']) || !isset($_POST['confirm_new_password']))) {
    $_POST = openld_trim_array($_POST);
    $_POST['reciprocal_links'] = isset($_POST['reciprocal_links']) ? 'Y' : 'N';
    $_POST['regular_links'] = isset($_POST['regular_links']) ? 'Y' : 'N';
    $_POST['paid_links'] = isset($_POST['paid_links']) ? 'Y' : 'N';
    $_POST['sponsored_links'] = isset($_POST['sponsored_links']) ? 'Y' : 'N';
    $_POST['disable_extensions'] = isset($_POST['disable_extensions']) ? 'Y' : 'N';
    $_POST['gzip'] = isset($_POST['gzip']) ? 'Y' : 'N';
    $_POST['hide_admin_button'] = isset($_POST['hide_admin_button']) ? 'Y' : 'N';
    $_POST['deny_index_page_submissions'] = isset($_POST['deny_index_page_submissions']) ? 'Y' : 'N';
    $_POST['display_unaccepted_links'] = isset($_POST['display_unaccepted_links']) ? 'Y' : 'N';
    $_POST['open_links_in_new_windows'] = isset($_POST['open_links_in_new_windows']) ? 'Y' : 'N';
    // Make sure that base_url doesn't end with a slash
    $_POST['domain_name_or_path'] = remove_last_slash($_POST['domain_name_or_path']);
    $error->check_email($_POST['admin_email'] = check_if_null($_POST['admin_email']));
    //$error->check_admin_title(check_if_null($_POST['admin_title']));
    //Admin should not be forced to enter a description
    //$error->check_admin_description(check_if_null($_POST['site_description']));
    $error->check_site_path(check_if_null($_POST['domain_name_or_path']));
    $error->check_language_preference(check_if_null($_POST['language']));
    $error->check_links_sorted_by(check_if_null($_POST['links_sorted_by']));
    $error->check_column_number(check_if_null($_POST['number_of_columns']));
    $error->check_links_per_page(check_if_null($_POST['links_per_page']));
    $error->numeric_control('search_volume_warning', check_if_null($_POST['number_of_search_results_per_page']), SEARCH_OPTION_WARNING);
    $error->check_maximum_vs_minimum_link_description(check_if_null($_POST['admin_max_description__link']), check_if_null($_POST['admin_min_description__link']));
    $error->check_maximum_vs_minimum_category_description(check_if_null($_POST['admin_max_description_category']), check_if_null($_POST['admin_min_description_category']));
    ($hook = get_hook('admin_options_check')) ? eval($hook) : null;
    // now.. print out the SQL
    if ($error->transform_error()) {
Exemple #3
0
            }
            break;
        case 'cancel':
            $success_message = PAYMENT_CANCELLED;
            break;
        case 'success':
            $success_message = SUBMIT_SUCCESS;
            break;
    }
}
($hook = get_hook('submit_before_input_check')) ? eval($hook) : null;
if (!empty($_POST) && (isset($_POST['title']) || isset($_POST['url']))) {
    $_GET['cat_id'] = isset($_REQUEST['cat_id']) && is_numeric($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : 0;
    $_POST = openld_trim_array($_POST);
    $_REQUEST = openld_trim_array($_REQUEST);
    $_POST['url'] = remove_last_slash($_POST['url']);
    if ($settings['reciprocal_links_option'] == 'Y' && $_POST['linktype'] == 'reciprocal') {
        $error->check_linktype(check_if_null($_POST['linktype']), $_POST['reciprocal_url'] = check_if_null($_POST['reciprocal_url']), check_if_null($_POST['url']));
    } else {
        $error->check_linktype(check_if_null($_POST['linktype']), null, check_if_null($_POST['url']));
    }
    $error->check_link_email($_POST['email'] = check_if_null($_POST['email']));
    $error->check_name($_POST['name'] = check_if_null($_POST['name']));
    $error->check_link_title($_POST['title'] = check_if_null($_POST['title']));
    $error->check_link_description($_POST['description'] = check_if_null($_POST['description']));
    $error->check_link_url($_POST['url'] = check_if_null($_POST['url']));
    $error->check_link_category_id(check_if_null($_POST['cat_id']));
    $if_reciprocal_column_name = $settings['reciprocal_links_option'] == 'Y' && $_POST['linktype'] == 'reciprocal' ? ', reciprocal_url' : '';
    //goes into the DB.. no lang variable
    $if_reciprocal_column_value = $settings['reciprocal_links_option'] == 'Y' && $_POST['linktype'] == 'reciprocal' ? ', ' . "'" . $db->escape($_POST['reciprocal_url']) . "'" : '';
    //goes into the DB.. no lang variable