Example #1
0
 *************/
define('ROOT_PATH', './');
require ROOT_PATH . 'inc-init.php';
if ($_AUTH) {
    // If authorized, check for updates.
    require ROOT_PATH . 'inc-upgrade.php';
}
// Require manager clearance.
lovd_requireAUTH(LEVEL_MANAGER);
if (PATH_COUNT == 1 && ACTION == 'edit') {
    // URL: /settings?edit
    // Edit system settings.
    define('PAGE_TITLE', 'Edit system settings');
    define('LOG_EVENT', 'ConfigEdit');
    require ROOT_PATH . 'class/object_system_settings.php';
    $_DATA = new LOVD_SystemSetting();
    $zData = $_CONF;
    require ROOT_PATH . 'inc-lib-form.php';
    if (!empty($_POST)) {
        lovd_errorClean();
        $_DATA->checkFields($_POST);
        if (!lovd_error()) {
            // Standard fields to be used.
            // FIXME; we can't use updateEntry() right now, because that needs an ID (and damn right, too). Now this is more manual work. Can we fix/bypass that?
            // FIXME; refseq_build is now just removed. Under certain conditions maybe it should be possible to change this setting, though.
            // FIXME; if you'd want to add stuff here, don't forget that in class/object_system_settings three variables are actively turned off:
            //$_POST['api_feed_history'] = 0;
            //$_POST['allow_count_hidden_entries'] = 0;
            //$_POST['use_versioning'] = 0;
            $aFields = array('system_title', 'institute', 'location_url', 'email_address', 'send_admin_submissions', 'api_feed_history', 'proxy_host', 'proxy_port', 'proxy_username', 'proxy_password', 'logo_uri', 'send_stats', 'include_in_listing', 'allow_submitter_registration', 'lock_users', 'allow_unlock_accounts', 'allow_submitter_mods', 'allow_count_hidden_entries', 'use_ssl', 'use_versioning');
            // Prepare values.
Example #2
0
} elseif ($_GET['step'] == 2) {
    $_GET['step']++;
}
if ($_GET['step'] == 3 && !($_DB->query('SHOW TABLES LIKE "' . TABLE_CONFIG . '"')->fetchColumn() && $_DB->query('SELECT COUNT(*) FROM ' . TABLE_CONFIG)->fetchColumn())) {
    // Step 3: Configuring general LOVD system settings.
    if (!$_DB->query('SHOW TABLES LIKE "' . TABLE_CONFIG . '"')->fetchColumn()) {
        // Didn't finish previous step correctly.
        header('Location: ' . PROTOCOL . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?step=' . ($_GET['step'] - 1));
        exit;
    }
    $_T->printHeader();
    lovd_printSideBar();
    require ROOT_PATH . 'inc-lib-form.php';
    // Load System Settings class.
    require ROOT_PATH . 'class/object_system_settings.php';
    $_SYSSETTING = new LOVD_SystemSetting();
    print '      <B>Configuring LOVD system settings</B><BR>' . "\n" . '      <BR>' . "\n\n";
    if (isset($_GET['sent'])) {
        lovd_errorClean();
        $_SYSSETTING->checkFields($_POST);
        if (!lovd_error()) {
            // Store information and go to next page.
            // FIXME; use object::insertEntry()
            if (empty($_POST['proxy_port'])) {
                // Empty port number, insert NULL instead of 0.
                $_POST['proxy_port'] = NULL;
            }
            $q = $_DB->query('INSERT INTO ' . TABLE_CONFIG . ' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($_POST['system_title'], $_POST['institute'], $_POST['location_url'], $_POST['email_address'], $_POST['send_admin_submissions'], $_POST['api_feed_history'], $_POST['refseq_build'], $_POST['proxy_host'], $_POST['proxy_port'], $_POST['proxy_username'], $_POST['proxy_password'], $_POST['logo_uri'], $_POST['mutalyzer_soap_url'], "", $_POST['send_stats'], $_POST['include_in_listing'], $_POST['allow_submitter_registration'], $_POST['lock_users'], $_POST['allow_unlock_accounts'], $_POST['allow_submitter_mods'], $_POST['allow_count_hidden_entries'], $_POST['use_ssl'], $_POST['use_versioning'], $_POST['lock_uninstall']), false, true);
            if (!$q) {
                // Error when running query.
                print '      Error during install while storing the settings.<BR>' . "\n" . '      I got:<DIV class="err">' . str_replace(array("\r\n", "\r", "\n"), '<BR>', $_DB->formatError()) . '</DIV><BR><BR>' . "\n" . '      A failed installation is most likely caused by a bug in LOVD.<BR>' . "\n" . '      Please <A href="' . $_SETT['upstream_BTS_URL_new_ticket'] . 'bugs/" target="_blank">file a bug</A> and include the above messages to help us solve the problem.<BR>' . "\n\n";