Exemple #1
0
				<p>We can also try saving the file automatically now.</p>

				<p><input type="submit" value="Save configuration"></p>
				</form>
			<?php 
        } else {
            print_error("Unfortunately, parent directory is not writable, so we're unable to save config.php automatically.");
        }
        print_notice("You can generate the file again by changing the form above.");
    } else {
        if ($op == "saveconfig") {
            print "<h2>Saving configuration file to parent directory...</h2>";
            if (!file_exists("../config.php")) {
                $fp = fopen("../config.php", "w");
                if ($fp) {
                    $written = fwrite($fp, make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, $DB_PORT, $SELF_URL_PATH));
                    if ($written > 0) {
                        print_notice("Successfully saved config.php. You can try <a href=\"..\">loading tt-rss now</a>.");
                    } else {
                        print_notice("Unable to write into config.php in tt-rss directory.");
                    }
                    fclose($fp);
                } else {
                    print_error("Unable to open config.php in tt-rss directory for writing.");
                }
            } else {
                print_error("config.php already present in tt-rss directory, refusing to overwrite.");
            }
        }
    }
}
Exemple #2
0
     } else {
         echo 'Sorry, this feature isn\'t available with ' . $db['choice'] . '.';
     }
     /* defined a var which is only there if successfully connected to the database and the database is found */
     $all_connected = true;
 }
 /* Create a config file if checked and if the connection went OK */
 if (isset($HTTP_POST_VARS['generate_config']) && $HTTP_POST_VARS['generate_config'] == true) {
     echo '<a name="config"><h3><u>Config file</u></h3></a>';
     if ($all_connected != true) {
         echo 'The database has not been successfully connected to so no config file has been generated.<br />';
     } else {
         echo 'Either copy the <b>19</b> lines below and save them as <u>config.php</u> or click on the <u>Download</u> button below. Then upload the file to your phpBB2 root directory (phpBB2/ by default). Make sure that there is nothing (this includes blank spaces) after the <u>?></u>.<br /><br />';
         /* Create our config file */
         echo '<form action="' . $HTTP_SERVER_VARS['SCRIPT_NAME'] . '" method="post"><table cellspacing="1" cellpadding="3" border="0"><tr><td class="code">';
         echo make_config($dbms, $dbhost, $dbname, $dbuser, $dbpasswd, $table_prefix);
         echo '</td></tr></table>';
         echo '<input type="hidden" name="dbms" value="' . $dbms . '" />';
         echo '<input type="hidden" name="dbhost" value="' . $dbhost . '" />';
         echo '<input type="hidden" name="dbname" value="' . $dbname . '" />';
         echo '<input type="hidden" name="dbuser" value="' . $dbuser . '" />';
         echo '<input type="hidden" name="dbpasswd" value="' . $dbpasswd . '" />';
         echo '<input type="hidden" name="table_prefix" value="' . $table_prefix . '" />';
         echo '<input type="hidden" name="download_config" value="true" />';
         echo '<br /><input type="submit" name="submit_download_config" value="Download" class="mainoption" /><br />';
     }
 }
 /* close the connection */
 if ($all_connected == true) {
     $db['close'];
 }