include_once $path_to_root . "/admin/db/company_db.inc"; include_once $path_to_root . "/admin/db/maintenance_db.inc"; include_once $path_to_root . "/includes/ui.inc"; //--------------------------------------------------------------------------------------------- if ($id = find_submit('Delete', false)) { $extensions = get_company_extensions(); if ($extensions[$id]['type'] == 'chart' && uninstall_package($extensions[$id]['package'])) { unset($extensions[$id]); if (update_extensions($extensions)) { display_notification(_("Selected chart has been successfully deleted")); meta_forward($_SERVER['PHP_SELF']); } } } if ($id = find_submit('Update', false)) { install_extension($id); } //--------------------------------------------------------------------------------------------- start_form(true); div_start('ext_tbl'); start_table(TABLESTYLE); $th = array(_("Chart"), _("Installed"), _("Available"), _("Encoding"), "", ""); table_header($th); $k = 0; $mods = get_charts_list(); foreach ($mods as $pkg_name => $ext) { $available = @$ext['available']; $installed = @$ext['version']; $id = @$ext['local_id']; $encoding = @$ext['encoding']; alt_table_row_color($k);
} elseif (get_post('install_langs')) { $ret = true; if (isset($_POST['langs'])) { foreach ($_POST['langs'] as $package => $ok) { $ret &= install_language($package); } } if ($ret) { $_POST['Page'] = $_SESSION['inst_set']['sel_coas'] ? 4 : 5; } } elseif (get_post('install_coas')) { $ret = true; $next_extension_id = 0; if (isset($_POST['coas'])) { foreach ($_POST['coas'] as $package => $ok) { $ret &= install_extension($package); } } if ($ret) { if (file_exists($path_to_root . '/installed_extensions.php')) { include $path_to_root . '/installed_extensions.php'; } $_POST['Page'] = 5; } } elseif (isset($_POST['set_admin'])) { // check company settings if (get_post('name') == '') { display_error(_('Company name cannot be empty.')); set_focus('name'); } elseif (get_post('admin') == '') { display_error(_('Company admin name cannot be empty.'));
function refresh_extension($id) { global $db; $query = array('SELECT' => 'id', 'FROM' => 'extensions', 'WHERE' => 'id="' . $id . '"'); //hook space $install_check = $db->query_build($query) or error(__FILE__, __LINE__); $installed = $db->num_rows($install_check) == 1 ? true : false; if ($installed === true) { uninstall_extension($id); install_extension($id); } }
} //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(); }
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ************************************************************************/ define('OPENLD_ROOT', './'); require OPENLD_ROOT . 'admin_header.php'; require OPENLD_ROOT . 'include/xml.php'; function get_ext_title($ext_file) { $ext_data = xml_to_array(@file_get_contents(OPENLD_ROOT . 'extensions/' . $ext_file . '/extension.xml')); $manifest_errors = validate_manifest($ext_data, $ext_file); return empty($manifest_errors) ? openld_htmlspecialchars($ext_data['extension']['title']) : $ext_file; } if (isset($_REQUEST['install'])) { install_extension($_REQUEST['install']); //reffresh page, in order to avoid $db error when Browser->Back after chmoding redirect($settings['domain'] . "/admin_extensions.php"); } elseif (isset($_REQUEST['uninstall'])) { uninstall_extension($_REQUEST['uninstall']); //reffresh page, in order to avoid $db error when Browser->Back after chmoding redirect($settings['domain'] . "/admin_extensions.php"); } elseif (isset($_REQUEST['id_edit'])) { $_REQUEST['hooks'] = str_replace('\\n', '\\n\\t\\t', $_REQUEST['hooks']); $ext_texta = '<?xml version="1.0" encoding="UTF-8"?> <extension> <id>' . $_REQUEST['id_edit'] . '</id> <title>' . $_REQUEST['title'] . '</title> <version>' . $_REQUEST['version'] . '</version> <author>' . $_REQUEST['author'] . '</author>